Merge branch 'master' into AL-4549
commit
f6615fef6e
2
pom.xml
2
pom.xml
|
@ -176,7 +176,7 @@
|
|||
<dependency>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>GeneradorBoletosCNAB</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<version>1.8.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
|
|
|
@ -5,13 +5,37 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.FIELD)
|
||||
/**
|
||||
* Anotação para marcar campos que devem ser renderizados e utilizados no Render Padrão {@link RenderPadrao}.
|
||||
*
|
||||
* A anotação permite configurar um conversor personalizado e especificar a posição de ordenação dos campos.
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Renderizado{
|
||||
Class<? extends Enum<?>> conversor() default DefaultEnum.class;
|
||||
|
||||
String metodoConversor() default "buscarPeloValor";
|
||||
|
||||
enum DefaultEnum{
|
||||
}
|
||||
public @interface Renderizado {
|
||||
|
||||
/**
|
||||
* Define a classe do conversor que será usado para converter o valor do campo.
|
||||
*
|
||||
* @return A classe Enum do conversor que deve obrigatoriamente
|
||||
* implementar o um metodo String buscarPeloValor( String valor).
|
||||
*/
|
||||
Class<? extends Enum<?>> conversor() default DefaultEnum.class;
|
||||
|
||||
/**
|
||||
* Define o nome do método do conversor que será chamado para converter o valor do campo.
|
||||
*
|
||||
* @return O nome do método do conversor. O padrão é "buscarPeloValor".
|
||||
*/
|
||||
String metodoConversor() default "buscarPeloValor";
|
||||
|
||||
/**
|
||||
* Define a posição de ordenação do campo. Campos com valores menores são ordenados primeiro.
|
||||
*
|
||||
* @return A posição numerica de ordenação do campo .
|
||||
*/
|
||||
int posicao() default Integer.MAX_VALUE;
|
||||
|
||||
enum DefaultEnum {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Voucher;
|
||||
|
||||
public interface VoucherDAO extends GenericDAO<Voucher, Long> {
|
||||
|
||||
public List<Voucher> buscarConsulta(Long voucherId, String numContrato, String nit, String nomeTransportadora, Date dataInicial, Date dataFinal, Integer origemId, Integer destinoId);
|
||||
|
||||
}
|
|
@ -7,10 +7,9 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.GenericDAO;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.criterion.Criterion;
|
||||
import org.hibernate.criterion.Projections;
|
||||
|
@ -24,6 +23,8 @@ import org.hibernate.loader.criteria.CriteriaLoader;
|
|||
import org.hibernate.persister.entity.OuterJoinLoadable;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.GenericDAO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gleimar
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.hibernate.type.StringType;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.zkoss.util.resource.Labels;
|
||||
|
||||
import com.rjconsultores.ventaboletos.ArquivoRemessa;
|
||||
import com.rjconsultores.ventaboletos.ArquivoRemessaItem;
|
||||
|
@ -73,6 +74,7 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
|||
import com.rjconsultores.ventaboletos.enuns.Aceite;
|
||||
import com.rjconsultores.ventaboletos.enuns.BancoLayout;
|
||||
import com.rjconsultores.ventaboletos.enuns.TipoInscricaoPagador;
|
||||
import com.rjconsultores.ventaboletos.exception.ComissaoException;
|
||||
import com.rjconsultores.ventaboletos.exception.ValidacaoRemessaException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||
|
@ -1330,7 +1332,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
|
||||
sb.append("SELECT ");
|
||||
sb.append("fb.FECHAMENTOBOLETO_ID AS \"id\", ");
|
||||
sb.append("(NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", ");
|
||||
sb.append("(NVL(fp.COUNT_REMESSA, 1) + 1) AS \"idRemessa\", ");
|
||||
sb.append("fp.COD_EMP_BANCO AS \"codEmpresaBanco\", ");
|
||||
sb.append("emp.CNPJ AS \"cnpj\", ");
|
||||
sb.append("emp.NOMBEMPRESA AS \"nomeEmpresa\", ");
|
||||
|
@ -1357,7 +1359,8 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
sb.append("ci.NOMBCIUDAD AS \"cidadePagador\", ");
|
||||
sb.append("es.NOMBESTADO AS \"estadoPagador\", ");
|
||||
sb.append("fp.BOLETO_BANCO_AGENCIA_DIGITO AS \"digitoAgencia\", ");
|
||||
sb.append("fp.BOLETO_BANCO_CARTEIRA_VARIAVEL AS \"variavelCarteira\" ");
|
||||
sb.append("fp.BOLETO_BANCO_CARTEIRA_VARIAVEL AS \"variavelCarteira\", ");
|
||||
sb.append("es.CVEESTADO AS \"cveEstado\" ");
|
||||
writeFROMClause(sb, dataDe != null && dataAte != null, reenviar);
|
||||
|
||||
Query query = getSession().createSQLQuery(sb.toString());
|
||||
|
@ -1372,7 +1375,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
|
||||
String nomeArquivo = "Sicoob" + new SimpleDateFormat("ddMM").format(new Date());
|
||||
int variavel = 0;
|
||||
int seqRegistro = 0;
|
||||
int seqRegistro = 1;
|
||||
int qtdeTitulos = 0;
|
||||
BigDecimal valorTitulos = BigDecimal.ZERO;
|
||||
|
||||
|
@ -1417,8 +1420,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
cabecalhoLoteRemessaSicoob.setDigContaCorrente(tupla[7].toString());
|
||||
cabecalhoLoteRemessaSicoob.setNomeEmpresa(nomeEmpresa);
|
||||
cabecalhoLoteRemessaSicoob.setNumeroRemessa(idRemessa);
|
||||
cabecalhoLoteRemessaSicoob.setDataGeracao(new Date());
|
||||
|
||||
cabecalhoLoteRemessaSicoob.setDataGeracao(new Date());
|
||||
cabecalhoRemessaSicoob.setCabecalhoLoteRemessaSicoob(cabecalhoLoteRemessaSicoob);
|
||||
|
||||
arquivoRemessaItem = new ArquivoRemessaSicoob();
|
||||
|
@ -1428,10 +1430,10 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
}else {
|
||||
try{
|
||||
if( !(cabecalhoRemessaSicoob.getNumConvenio()).equals(codEmpresaBanco)) {
|
||||
throw new ValidacaoRemessaException("O codigo de convênio não confere com o codigo do banco \r\n favor entrar em contato com o suporte! ");
|
||||
throw new ValidacaoRemessaException(Labels.getLabel("relatorioRemessaCNAB.exception.ValidacaoRemessaConvenioException"));
|
||||
}
|
||||
}catch(Exception e){
|
||||
throw new ValidacaoRemessaException("Houve um erro na montagem do cabeçalho do arquivo de remessa \r\n favor entrar em contato com o suporte! ");
|
||||
throw new ValidacaoRemessaException(Labels.getLabel("relatorioRemessaCNAB.exception.ValidacaoRemessaMontagemCabecalhoException"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1449,13 +1451,14 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
titulosSicoob.setVencimento((Date) tupla[10]);
|
||||
titulosSicoob.setValor( valor );
|
||||
titulosSicoob.setEmissao((Date) tupla[13]);
|
||||
titulosSicoob.setCodCarteira(Integer.valueOf(tupla[8].toString()));
|
||||
try{
|
||||
titulosSicoob.setCodMora(1);
|
||||
titulosSicoob.setJurosDeMora(new BigDecimal(tupla[16].toString().replaceAll(",", ".")));
|
||||
titulosSicoob.setDataMora((Date) tupla[10]);
|
||||
titulosSicoob.setDataMora(DateUtil.somarDias((Date) tupla[10], 1));
|
||||
}catch(NullPointerException e){
|
||||
titulosSicoob.setCodMora(1);
|
||||
titulosSicoob.setDataMora((Date) tupla[10]);
|
||||
titulosSicoob.setCodMora(BigDecimal.ZERO.intValue());
|
||||
titulosSicoob.setDataMora(null);
|
||||
titulosSicoob.setJurosDeMora(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
|
@ -1464,8 +1467,8 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
titulosSicoob.setDataDesconto((Date) tupla[10]);
|
||||
titulosSicoob.setDescontoConcedido(new BigDecimal(tupla[17].toString().replaceAll(",", ".")));
|
||||
}catch(NullPointerException e){
|
||||
titulosSicoob.setCodigoDesconto(1);
|
||||
titulosSicoob.setDataDesconto((Date) tupla[10]);
|
||||
titulosSicoob.setCodigoDesconto(BigDecimal.ZERO.intValue());
|
||||
titulosSicoob.setDataDesconto(null);
|
||||
titulosSicoob.setDescontoConcedido(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
|
@ -1476,10 +1479,10 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
titulosSicoob.setAbatimentoConcedido(BigDecimal.ZERO);
|
||||
}
|
||||
titulosSicoob.setNossoNumeroEmp(tupla[0].toString());
|
||||
titulosSicoob.setCodigoProtesto(3);
|
||||
titulosSicoob.setDiasProtesto(0);
|
||||
titulosSicoob.setCodigoProtesto(1);
|
||||
titulosSicoob.setDiasProtesto(1);
|
||||
titulosSicoob.setCodigoBaixa(2);
|
||||
titulosSicoob.setDiasBaixa(0);
|
||||
titulosSicoob.setDiasBaixa(000);
|
||||
titulosSicoob.setNumeroContrato(Integer.parseInt(tupla[0].toString()));
|
||||
|
||||
DetalheObrigatorioDadosPagadorSicoob pagadorSicoob = new DetalheObrigatorioDadosPagadorSicoob();
|
||||
|
@ -1502,31 +1505,37 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO<Fechament
|
|||
try{
|
||||
pagadorSicoob.setNumeroInscricaoSacado(tupla[20].toString());
|
||||
}catch(Exception e){
|
||||
throw new ValidacaoRemessaException("O CNPJ do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir");
|
||||
throw new ValidacaoRemessaException("relatorioRemessaCNAB.exception.ValidacaoRemessaCNPJException", null, tupla[20]);
|
||||
}
|
||||
|
||||
try{
|
||||
pagadorSicoob.setLogradouroSacado(tupla[22].toString());
|
||||
}catch(Exception e){
|
||||
throw new ValidacaoRemessaException("O Logradouro do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir");
|
||||
throw new ValidacaoRemessaException("relatorioRemessaCNAB.exception.ValidacaoRemessaLogradouroException", null, tupla[22]);
|
||||
}
|
||||
|
||||
try{
|
||||
pagadorSicoob.setBairroSacado(tupla[23].toString());
|
||||
}catch(Exception e){
|
||||
throw new ValidacaoRemessaException("O Bairro do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir");
|
||||
throw new ValidacaoRemessaException("relatorioRemessaCNAB.exception.ValidacaoRemessaBairroException", null, tupla[23]);
|
||||
}
|
||||
|
||||
try{
|
||||
pagadorSicoob.setCidade(tupla[25].toString());
|
||||
}catch(Exception e){
|
||||
throw new ValidacaoRemessaException("A cidade do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir");
|
||||
throw new ValidacaoRemessaException("relatorioRemessaCNAB.exception.ValidacaoRemessaCidadeException", null, tupla[25]);
|
||||
}
|
||||
|
||||
try{
|
||||
pagadorSicoob.setEstado(tupla[26].toString());
|
||||
}catch(Exception e){
|
||||
throw new ValidacaoRemessaException("O Estado do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir");
|
||||
throw new ValidacaoRemessaException("relatorioRemessaCNAB.exception.ValidacaoRemessaEstadoException", null, tupla[26]);
|
||||
}
|
||||
|
||||
try{
|
||||
pagadorSicoob.setCveEstado(tupla[29].toString());
|
||||
}catch(Exception e){
|
||||
throw new ValidacaoRemessaException("relatorioRemessaCNAB.exception.ValidacaoRemessaCVEEstadoException", null, tupla[29]);
|
||||
}
|
||||
|
||||
titulosSicoob.setDetalheObrigatorioDadosPagadorSicoob(pagadorSicoob);
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.VoucherDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Voucher;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Repository("voucherDAO")
|
||||
public class VoucherHibernateDAO extends GenericHibernateDAO<Voucher, Long> implements VoucherDAO {
|
||||
|
||||
@Autowired
|
||||
public VoucherHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Voucher> obtenerTodos() {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
c.add(Restrictions.eq(ACTIVO, Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Voucher> buscarConsulta(Long voucherId,
|
||||
String numContrato,
|
||||
String nit,
|
||||
String nomeTransportadora,
|
||||
Date dataInicial,
|
||||
Date dataFinal,
|
||||
Integer origemId,
|
||||
Integer destinoId) {
|
||||
|
||||
StringBuilder hql = new StringBuilder();
|
||||
hql.append("SELECT v, ori.descParada AS descOrigem , des.descParada AS descDestino ");
|
||||
hql.append("FROM Voucher v ");
|
||||
|
||||
setJoins( numContrato,
|
||||
nit,
|
||||
nomeTransportadora,
|
||||
hql);
|
||||
|
||||
hql.append("WHERE v.activo = 1 ");
|
||||
|
||||
setClausulas(voucherId,
|
||||
numContrato,
|
||||
nit,
|
||||
nomeTransportadora,
|
||||
dataInicial,
|
||||
dataFinal,
|
||||
origemId,
|
||||
destinoId,
|
||||
hql);
|
||||
|
||||
hql.append("ORDER BY voucherId ");
|
||||
|
||||
Query query = getSession().createQuery(hql.toString());
|
||||
|
||||
setParametros(voucherId,
|
||||
numContrato,
|
||||
nit,
|
||||
nomeTransportadora,
|
||||
dataInicial,
|
||||
dataFinal,
|
||||
origemId,
|
||||
destinoId,
|
||||
query);
|
||||
|
||||
return query.list();
|
||||
}
|
||||
|
||||
private void setJoins(String numContrato, String nit, String nomeTransportadora, StringBuilder hql) {
|
||||
hql.append("LEFT JOIN Parada ori ON v.origenId = ori.origenId ");
|
||||
hql.append("LEFT JOIN Parada des ON v.origenId = des.origenId ");
|
||||
|
||||
}
|
||||
|
||||
private void setClausulas(Long voucherId, String numContrato, String nit, String nomeTransportadora,
|
||||
Date dataInicial, Date dataFinal, Integer origemId, Integer destinoId, StringBuilder hql) {
|
||||
if(voucherId != null ){
|
||||
hql.append(" AND v.voucherId = :voucherId ");
|
||||
}
|
||||
|
||||
if(numContrato != null ){
|
||||
hql.append(" AND v.voucherId = :voucherId ");
|
||||
}
|
||||
|
||||
if(nit != null ){
|
||||
hql.append(" AND v.voucherId = :voucherId ");
|
||||
}
|
||||
|
||||
if(nomeTransportadora != null ){
|
||||
hql.append(" AND v.voucherId = :voucherId ");
|
||||
}
|
||||
|
||||
if(dataInicial != null ){
|
||||
hql.append(" AND v.dataValidade >= :dataInicial ");
|
||||
}
|
||||
|
||||
if(dataFinal != null ){
|
||||
hql.append(" AND v.dataValidade <= :dataFinal ");
|
||||
}
|
||||
|
||||
if(origemId != null ){
|
||||
hql.append(" AND v.origenId = :origemId ");
|
||||
}
|
||||
|
||||
if(destinoId != null ){
|
||||
hql.append(" AND v.destinoId = :destinoId ");
|
||||
}
|
||||
}
|
||||
|
||||
private void setParametros(Long voucherId,
|
||||
String numContrato,
|
||||
String nit,
|
||||
String nomeTransportadora,
|
||||
Date dataInicial,
|
||||
Date dataFinal,
|
||||
Integer origemId,
|
||||
Integer destinoId,
|
||||
Query query) {
|
||||
|
||||
if(voucherId != null ){
|
||||
query.setLong("voucherId", voucherId);
|
||||
}
|
||||
|
||||
if(numContrato != null ){
|
||||
query.setString("numContrato", numContrato);
|
||||
}
|
||||
|
||||
if(nit != null ){
|
||||
query.setString("nit", nit);
|
||||
}
|
||||
|
||||
if(nomeTransportadora != null ){
|
||||
query.setString("nomeTransportadora", nomeTransportadora);
|
||||
}
|
||||
|
||||
if(dataInicial != null ){
|
||||
query.setDate("dataInicial", dataInicial);
|
||||
}
|
||||
|
||||
if(dataFinal != null ){
|
||||
query.setDate("dataFinal", dataFinal);
|
||||
}
|
||||
|
||||
if(origemId != null ){
|
||||
query.setInteger("origemId", origemId);
|
||||
}
|
||||
|
||||
if(destinoId != null ){
|
||||
query.setInteger("destinoId", destinoId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -165,5 +165,10 @@ public class ContratoCorporativo implements Serializable {
|
|||
hash = 59 * hash + (this.getContratoId() != null ? this.getContratoId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getContratoId().toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -61,5 +61,13 @@ public class Transportadora implements Serializable{
|
|||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecModif;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return nomeTransportadora;
|
||||
}
|
||||
|
||||
public Transportadora(String nomeTransportadora) {
|
||||
this.nomeTransportadora = nomeTransportadora;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.rjconsultores.ventaboletos.anotacao.Renderizado;
|
||||
import com.rjconsultores.ventaboletos.enums.SituacaoVoucher;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Entity
|
||||
@SequenceGenerator(name = "VOUCHER_SEQ", sequenceName = "VOUCHER_SEQ", allocationSize = 1)
|
||||
@Table(name = "VOUCHER")
|
||||
public class Voucher implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3684489881654368314L;
|
||||
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "VOUCHER_SEQ")
|
||||
@Renderizado( posicao = 1)
|
||||
@Column(name = "VOUCHER_ID")
|
||||
private Long voucherId;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "CONTRATO_ID")
|
||||
@Renderizado( posicao = 2)
|
||||
private ContratoCorporativo contrato;
|
||||
|
||||
@Column(name = "NOME_PASSAGEIRO", length = 150)
|
||||
private String nomePassageiro;
|
||||
|
||||
@Column(name = "NUM_FATURA", length = 30)
|
||||
private String numFatura;
|
||||
|
||||
@Column(name = "VALOR_LICITADO")
|
||||
@Renderizado( posicao = 5 )
|
||||
private BigDecimal valorLicitado;
|
||||
|
||||
@Renderizado( posicao = 6)
|
||||
@Column(name = "VALOR_LEGALIZADO")
|
||||
private BigDecimal valorLegalizado;
|
||||
|
||||
@Renderizado( posicao = 4)
|
||||
@Column(name = "DATA_VALIDADE")
|
||||
private Date dataValidade;
|
||||
|
||||
@Column(name = "DATA_INCLUSAO")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date dataInclusao;
|
||||
|
||||
@Column(name = "ORIGEN_ID")
|
||||
private Integer origenId;
|
||||
|
||||
@Column(name = "DESTINO_ID")
|
||||
private Integer destinoId;
|
||||
|
||||
@Column(name = "CLASESERVICIO_ID")
|
||||
private Long claseServicioId;
|
||||
|
||||
@Column(name = "STATUS")
|
||||
@Renderizado( conversor = SituacaoVoucher.class, posicao = 3)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "CLIENTECORPORATIVO_ID")
|
||||
private Long clienteCorporativoId;
|
||||
|
||||
@Column(name = "MOTIVOCANCELACION_ID")
|
||||
private Long motivoCancelacionId;
|
||||
|
||||
@Column(name = "GRUPOCONTRATO_ID")
|
||||
private Long grupoContratoId;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "TRANSPORTADORA_ID")
|
||||
private Transportadora transportadora;
|
||||
|
||||
@Column(name = "ACTIVO")
|
||||
private boolean activo;
|
||||
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecModif;
|
||||
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
|
||||
@Transient
|
||||
@Renderizado( posicao = 7 )
|
||||
private transient String descOrigem;
|
||||
|
||||
@Transient
|
||||
@Renderizado( posicao = 8 )
|
||||
private String descDestino;
|
||||
|
||||
public SituacaoVoucher getSituacaoVoucher() {
|
||||
return SituacaoVoucher.buscarPeloValor(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Voucher other = (Voucher) obj;
|
||||
return this.getVoucherId().equals(other.getVoucherId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 59 * hash + (this.getVoucherId() != null ? this.getVoucherId().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.rjconsultores.ventaboletos.enums;
|
||||
|
||||
import org.zkoss.util.resource.Labels;
|
||||
|
||||
public enum SituacaoVoucher {
|
||||
|
||||
EMITIDO(0,Labels.getLabel("label.situacaoVoucher.emitido")),
|
||||
LEGALIZADO(1,Labels.getLabel("label.situacaoVoucher.legalizado")),
|
||||
FATURADO(2,Labels.getLabel("label.situacaoVoucher.faturado")),
|
||||
CANCELADO(3,Labels.getLabel("label.situacaoVoucher.cancelado")),
|
||||
;
|
||||
|
||||
private Integer valor;
|
||||
private String descricao;
|
||||
|
||||
private SituacaoVoucher(Integer valor, String descricao) {
|
||||
this.valor = valor;
|
||||
this.descricao = descricao;
|
||||
}
|
||||
|
||||
public String getDescricao() {
|
||||
return descricao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getDescricao();
|
||||
}
|
||||
|
||||
public Integer getValor() {
|
||||
return valor;
|
||||
}
|
||||
|
||||
public static SituacaoVoucher buscarPeloValor(Integer valor) {
|
||||
|
||||
for (SituacaoVoucher tipo : SituacaoVoucher.values()) {
|
||||
if (tipo.getValor().equals(valor)) {
|
||||
return tipo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SituacaoVoucher buscarPeloValor(String valor) {
|
||||
return buscarPeloValor( Integer.valueOf(valor));
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ public enum TipoLancamentoCaixa {
|
|||
BILHETE_CONFIRMADO(4,Labels.getLabel("label.tipoLancamento.bilheteConfirmado"), false),
|
||||
BILHETE_ABERTO(5,Labels.getLabel("label.tipoLancamento.bilheteAberto"), false),
|
||||
EVENTO_EXTRA(6,Labels.getLabel("label.tipoLancamento.eventoExtra"), false),
|
||||
VOUCHER(7,Labels.getLabel("label.tipoLancamento.voucher"), false),
|
||||
;
|
||||
|
||||
private Integer valor;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package com.rjconsultores.ventaboletos.exception;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.zkoss.util.resource.Labels;
|
||||
|
||||
public class ValidacaoRemessaException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -919934943159729995L;
|
||||
|
@ -7,5 +11,9 @@ public class ValidacaoRemessaException extends RuntimeException {
|
|||
public ValidacaoRemessaException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ValidacaoRemessaException(String message, Object oMsg, Object... parametros) {
|
||||
super(new MessageFormat(Labels.getLabel(message, parametros)).format(oMsg));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.rjconsultores.ventaboletos.exception.BusinessException;
|
|||
|
||||
public interface ConvenioTransportadoraService extends GenericService<ConvenioTransportadora, Long> {
|
||||
|
||||
ConvenioTransportadora buscarPelaTransportadoraId(Long transportadoraId);
|
||||
public ConvenioTransportadora buscarPelaTransportadoraId(Long transportadoraId);
|
||||
|
||||
public ConvenioTransportadora suscribirActualizar(ConvenioTransportadora convenio) throws BusinessException;
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Voucher;
|
||||
|
||||
public interface VoucherService extends GenericService<Voucher, Long> {
|
||||
|
||||
List<Voucher> buscarConsulta(Long voucherId, String numContrato, String nit, String nomeTransportadora, Date dataInicial, Date dataFinal, Integer origemId, Integer destinoId);
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.VoucherDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Voucher;
|
||||
import com.rjconsultores.ventaboletos.service.VoucherService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
@Service("voucherService")
|
||||
public class VoucherServiceImpl implements VoucherService {
|
||||
|
||||
@Autowired
|
||||
private VoucherDAO voucherDAO;
|
||||
|
||||
public List<Voucher> obtenerTodos() {
|
||||
return voucherDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
public Voucher obtenerID(Long id) {
|
||||
return voucherDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Voucher suscribir(Voucher entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecModif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
|
||||
return voucherDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Voucher actualizacion(Voucher entidad) {
|
||||
return voucherDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void borrar(Voucher entidad) {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecModif(Calendar.getInstance().getTime());
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
|
||||
voucherDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Voucher> buscarConsulta(Long voucherId,
|
||||
String numContrato,
|
||||
String nit,
|
||||
String nomeTransportadora,
|
||||
Date dataInicial,
|
||||
Date dataFinal,
|
||||
Integer origemId,
|
||||
Integer destinoId) {
|
||||
return voucherDAO.buscarConsulta(voucherId,
|
||||
numContrato,
|
||||
nit,
|
||||
nomeTransportadora,
|
||||
dataInicial,
|
||||
dataFinal,
|
||||
origemId,
|
||||
destinoId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue