Fixes bug #AL-4506

master
Luis Angel Espina Hernandez 2024-08-27 12:49:07 -04:00
commit 2ae490451d
13 changed files with 460 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ModelWeb</artifactId> <artifactId>ModelWeb</artifactId>
<version>1.98.1</version> <version>1.100.0</version>
<distributionManagement> <distributionManagement>
<repository> <repository>

View File

@ -9,5 +9,7 @@ import com.rjconsultores.ventaboletos.entidad.AliasClasse;
public List<AliasClasse> buscar(Integer classe,Integer alias,Integer orgaoConcedente); public List<AliasClasse> buscar(Integer classe,Integer alias,Integer orgaoConcedente);
public AliasClasse existe(Integer classe, Integer alias, Integer orgaoConcedente, Integer aliasClasseId); public AliasClasse existe(Integer classe, Integer alias, Integer orgaoConcedente, Integer aliasClasseId);
public List<AliasClasse> buscar(Integer classe, Integer alias, Integer orgaoConcedente,Integer empresaId, Integer rutaId);
} }

View File

@ -0,0 +1,8 @@
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig;
public interface EmpresaNequiConfigDAO extends GenericDAO<EmpresaNequiConfig, Integer> {
public EmpresaNequiConfig buscarByEmpresa(Integer empresaId);
}

View File

@ -66,4 +66,26 @@ public class AliasClasseHibernateDAO extends GenericHibernateDAO<AliasClasse, In
return c.list(); return c.list();
} }
@Override
public List<AliasClasse> buscar(Integer classe, Integer alias, Integer orgaoConcedente, Integer empresaId, Integer rutaId) {
Criteria c = makeCriteria();
c.add(Restrictions.eq(ACTIVO, Boolean.TRUE));
if( classe != null ) {
c.add(Restrictions.eq("classe.claseservicioId",classe));
}
if ( alias != null ) {
c.add(Restrictions.eq("alias.claseservicioId",alias));
}
if( orgaoConcedente != null ) {
c.add(Restrictions.eq("orgaoConcedente.orgaoConcedenteId", orgaoConcedente));
}
c.add(empresaId == null ? Restrictions.isNull("empresa.empresaId") : Restrictions.eq("empresa.empresaId", empresaId));
c.add(rutaId == null ? Restrictions.isNull("ruta.rutaId") : Restrictions.eq("ruta.rutaId", rutaId));
return c.list();
}
} }

View File

@ -0,0 +1,39 @@
package com.rjconsultores.ventaboletos.dao.hibernate;
import java.util.List;
import org.hibernate.Criteria;
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.EmpresaNequiConfigDAO;
import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig;
@Repository("empresaNequiConfigDAO")
public class EmpresaNequiConfigHibernateDAO extends GenericHibernateDAO<EmpresaNequiConfig, Integer>
implements EmpresaNequiConfigDAO {
@Autowired
public EmpresaNequiConfigHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<EmpresaNequiConfig> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq(ACTIVO, Boolean.TRUE));
return c.list();
}
public EmpresaNequiConfig buscarByEmpresa(Integer empresaId) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq(ACTIVO, Boolean.TRUE));
c.add(Restrictions.eq("empresa.empresaId", empresaId));
return (EmpresaNequiConfig) c.uniqueResult();
}
}

View File

@ -0,0 +1,125 @@
package com.rjconsultores.ventaboletos.entidad;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
public class CampanhaCupomSorteado {
@Id
@Column(name = "CONVENIOCUPOMSORTEADO_ID")
private Integer campanhaCupomSorteadoId;
@JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID")
@ManyToOne
private Convenio convenio;
@JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID")
@ManyToOne
private Empresa empresa;
@JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
@ManyToOne
private PuntoVenta puntoVenta;
@JoinColumn(name = "BOLETOSORTEADO_ID", referencedColumnName = "BOLETO_ID")
@ManyToOne
private Boleto boletoSorteado;
@JoinColumn(name = "BOLETOCUPOM_ID", referencedColumnName = "BOLETO_ID")
@ManyToOne
private Boleto boletoCupom;
private String codigoCupom;
private Date fecmodif;
private Integer usuarioId;
private Boolean activo;
private Date feccreacion;
public Integer getCampanhaCupomSorteadoId() {
return campanhaCupomSorteadoId;
}
public void setCampanhaCupomSorteadoId(Integer campanhaCupomSorteadoId) {
this.campanhaCupomSorteadoId = campanhaCupomSorteadoId;
}
public Convenio getConvenio() {
return convenio;
}
public void setConvenio(Convenio convenio) {
this.convenio = convenio;
}
public Empresa getEmpresa() {
return empresa;
}
public void setEmpresa(Empresa empresa) {
this.empresa = empresa;
}
public PuntoVenta getPuntoVenta() {
return puntoVenta;
}
public void setPuntoVenta(PuntoVenta puntoVenta) {
this.puntoVenta = puntoVenta;
}
public Boleto getBoletoSorteado() {
return boletoSorteado;
}
public void setBoletoSorteado(Boleto boletoSorteado) {
this.boletoSorteado = boletoSorteado;
}
public Boleto getBoletoCupom() {
return boletoCupom;
}
public void setBoletoCupom(Boleto boletoCupom) {
this.boletoCupom = boletoCupom;
}
public String getCodigoCupom() {
return codigoCupom;
}
public void setCodigoCupom(String codigoCupom) {
this.codigoCupom = codigoCupom;
}
public Date getFecmodif() {
return fecmodif;
}
public void setFecmodif(Date fecmodif) {
this.fecmodif = fecmodif;
}
public Integer getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Integer usuarioId) {
this.usuarioId = usuarioId;
}
public Boolean getActivo() {
return activo;
}
public void setActivo(Boolean activo) {
this.activo = activo;
}
public Date getFeccreacion() {
return feccreacion;
}
public void setFeccreacion(Date feccreacion) {
this.feccreacion = feccreacion;
}
}

View File

@ -46,6 +46,21 @@ public class ConexionRutaConf implements Serializable {
@Column(name = "DESCUENTO") @Column(name = "DESCUENTO")
private BigDecimal descuento; private BigDecimal descuento;
@Column(name = "ISBLOQUEIOTRECHO_A")
private Boolean isBloqueioTrechoA;
@Column(name = "ISBLOQUEIOTRECHO_B")
private Boolean isBloqueioTrechoB;
@Column(name = "ISBLOQUEIOTRECHO_C")
private Boolean isBloqueioTrechoC;
@Column(name = "PORCENTAGEM_OCUPACAO")
private Integer porcentagemOcupacao;
@Column(name = "MINUTOS_ANTES_PARTIDA")
private Integer minutosAntesPartida;
public ConexionRutaConf() { public ConexionRutaConf() {
super(); super();
} }
@ -144,4 +159,44 @@ public class ConexionRutaConf implements Serializable {
public void setDescuento(BigDecimal descuento) { public void setDescuento(BigDecimal descuento) {
this.descuento = descuento; this.descuento = descuento;
} }
public Boolean getIsBloqueioTrechoA() {
return isBloqueioTrechoA == null ? false: isBloqueioTrechoA;
}
public void setIsBloqueioTrechoA(Boolean isBloqueioTrechoA) {
this.isBloqueioTrechoA = isBloqueioTrechoA;
}
public Boolean getIsBloqueioTrechoB() {
return isBloqueioTrechoB == null ? false: isBloqueioTrechoB;
}
public void setIsBloqueioTrechoB(Boolean isBloqueioTrechoB) {
this.isBloqueioTrechoB = isBloqueioTrechoB;
}
public Boolean getIsBloqueioTrechoC() {
return isBloqueioTrechoC == null ? false: isBloqueioTrechoC;
}
public void setIsBloqueioTrechoC(Boolean isBloqueioTrechoC) {
this.isBloqueioTrechoC = isBloqueioTrechoC;
}
public Integer getPorcentagemOcupacao() {
return porcentagemOcupacao;
}
public void setPorcentagemOcupacao(Integer porcentagemOcupacao) {
this.porcentagemOcupacao = porcentagemOcupacao;
}
public Integer getMinutosAntesPartida() {
return minutosAntesPartida;
}
public void setMinutosAntesPartida(Integer minutosAntesPartida) {
this.minutosAntesPartida = minutosAntesPartida;
}
} }

View File

@ -0,0 +1,127 @@
package com.rjconsultores.ventaboletos.entidad;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
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;
@Entity
@SequenceGenerator(name = "EMP_NEQUI_CONFIG_SEQ", sequenceName = "EMP_NEQUI_CONFIG_SEQ", allocationSize = 1)
@Table(name = "EMPRESA_NEQUI_CONFIG")
public class EmpresaNequiConfig implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMP_NEQUI_CONFIG_SEQ")
@Column(name = "EMPRESANEQUICONFIG_ID")
private Integer empresaNequiConfigId;
@OneToOne
@JoinColumn(name = "EMPRESA_ID")
private Empresa empresa;
@Column(name = "CLIENTID_NEQUI")
private String clienteIdNequi;
@Column(name = "HASH")
private String hash;
@Column(name = "API_KEY_NEQUI")
private String apiKey;
@Column(name = "URL")
private String url;
@Column(name = "CODE")
private String code;
private Boolean activo;
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
public Integer getEmpresaNequiConfigId() {
return empresaNequiConfigId;
}
public void setEmpresaNequiConfigId(Integer empresaNequiConfigId) {
this.empresaNequiConfigId = empresaNequiConfigId;
}
public Empresa getEmpresa() {
return empresa;
}
public void setEmpresa(Empresa empresa) {
this.empresa = empresa;
}
public String getClienteIdNequi() {
return clienteIdNequi;
}
public void setClienteIdNequi(String clienteIdNequi) {
this.clienteIdNequi = clienteIdNequi;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Boolean getActivo() {
return activo;
}
public void setActivo(Boolean activo) {
this.activo = activo;
}
public Date getFecmodif() {
return fecmodif;
}
public void setFecmodif(Date fecmodif) {
this.fecmodif = fecmodif;
}
public Integer getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Integer usuarioId) {
this.usuarioId = usuarioId;
}
}

View File

@ -24,6 +24,7 @@ public enum TipoFormapago {
ADYEN(17,Labels.getLabel("editarFormaPagoController.lblAdyen.label")), ADYEN(17,Labels.getLabel("editarFormaPagoController.lblAdyen.label")),
MERCADO_PAGO(18,Labels.getLabel("editarFormaPagoController.lblMercadoPago.label")), MERCADO_PAGO(18,Labels.getLabel("editarFormaPagoController.lblMercadoPago.label")),
EMBARQUE_JA(19,Labels.getLabel("editarFormaPagoController.lblEmbarqueJa.label")), EMBARQUE_JA(19,Labels.getLabel("editarFormaPagoController.lblEmbarqueJa.label")),
NEQUI(19,Labels.getLabel("editarFormaPagoController.lblNequi.label"))
; ;
private Integer valor; private Integer valor;

View File

@ -0,0 +1,8 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig;
public interface EmpresaNequiConfigService extends GenericService<EmpresaNequiConfig, Integer> {
public EmpresaNequiConfig buscarByEmpresa(Integer empresaId);
}

View File

@ -33,8 +33,11 @@ public class AliasClasseServiceImpl implements AliasClasseService {
if ( (entidad.getClasse() == null) || (entidad.getAlias() == null) || (entidad.getOrgaoConcedente() == null) ){ if ( (entidad.getClasse() == null) || (entidad.getAlias() == null) || (entidad.getOrgaoConcedente() == null) ){
throw new BusinessException("MSG.camposObrigatorios"); throw new BusinessException("MSG.camposObrigatorios");
} }
//manter a compatibilidade com os cadastros ja existentes
Integer empresaId = entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null;
Integer rutaId = entidad.getRuta() != null ? entidad.getRuta().getRutaId() : null;
List<AliasClasse> lsBusca = aliasClasseDAO.buscar(entidad.getClasse().getClaseservicioId(), null, entidad.getOrgaoConcedente().getOrgaoConcedenteId()); List<AliasClasse> lsBusca = aliasClasseDAO.buscar(entidad.getClasse().getClaseservicioId(), entidad.getAlias().getClaseservicioId(), entidad.getOrgaoConcedente().getOrgaoConcedenteId(), empresaId, rutaId);
if (!lsBusca.isEmpty()){ if (!lsBusca.isEmpty()){

View File

@ -0,0 +1,60 @@
package com.rjconsultores.ventaboletos.service.impl;
import java.util.Calendar;
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.EmpresaNequiConfigDAO;
import com.rjconsultores.ventaboletos.entidad.EmpresaNequiConfig;
import com.rjconsultores.ventaboletos.service.EmpresaNequiConfigService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("empresaNequiConfigService")
public class EmpresaNequiConfigServiceImpl implements EmpresaNequiConfigService {
@Autowired
private EmpresaNequiConfigDAO empresaNequiConfigDAO;
public List<EmpresaNequiConfig> obtenerTodos() {
return empresaNequiConfigDAO.obtenerTodos();
}
public EmpresaNequiConfig obtenerID(Integer id) {
return empresaNequiConfigDAO.obtenerID(id);
}
@Transactional
public EmpresaNequiConfig suscribir(EmpresaNequiConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return empresaNequiConfigDAO.suscribir(entidad);
}
@Transactional
public EmpresaNequiConfig actualizacion(EmpresaNequiConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return empresaNequiConfigDAO.actualizacion(entidad);
}
@Transactional
public void borrar(EmpresaNequiConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
empresaNequiConfigDAO.actualizacion(entidad);
}
public EmpresaNequiConfig buscarByEmpresa(Integer empresaId) {
return empresaNequiConfigDAO.buscarByEmpresa(empresaId);
}
}

View File

@ -157,7 +157,14 @@ public enum CustomEnum {
VALIDA_ESTOQUE_SIMPLIFICADO("MODCLI_ValidaEstoqueSimplificado"), VALIDA_ESTOQUE_SIMPLIFICADO("MODCLI_ValidaEstoqueSimplificado"),
IS_VENDA_SAFTAO("isVendaSaftao"); IS_VENDA_SAFTAO("isVendaSaftao"),
/**
* Ativa o Bloqueio de trecho por conexao.
*
* @return
*/
USA_BLOQUEIO_TRECHO_CONEXAO("usaBloqueioTrechoConexao");
private String descricao; private String descricao;