fixes bug#13611
dev:lucas qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@90364 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
93b23fdee0
commit
c825f447a8
|
@ -0,0 +1,14 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Custom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Lucas
|
||||||
|
*/
|
||||||
|
public interface CustomDAO extends GenericDAO<Custom, Integer> {
|
||||||
|
|
||||||
|
public Custom buscar(String chave);
|
||||||
|
}
|
|
@ -40,6 +40,7 @@ import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
|
||||||
import com.rjconsultores.ventaboletos.service.PrecioFixoPedagioService;
|
import com.rjconsultores.ventaboletos.service.PrecioFixoPedagioService;
|
||||||
import com.rjconsultores.ventaboletos.service.RutaCombinacionService;
|
import com.rjconsultores.ventaboletos.service.RutaCombinacionService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
@Repository("calcularPeajeDAO")
|
@Repository("calcularPeajeDAO")
|
||||||
|
@ -408,7 +409,7 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO<String, Strin
|
||||||
private static BigDecimal calculateImportePeajeANTT(BigDecimal importe, BigDecimal icms,
|
private static BigDecimal calculateImportePeajeANTT(BigDecimal importe, BigDecimal icms,
|
||||||
BigDecimal indice, BigDecimal rutaCantEixos, BigDecimal rutaCantAsientos, boolean usaICMS) {
|
BigDecimal indice, BigDecimal rutaCantEixos, BigDecimal rutaCantAsientos, boolean usaICMS) {
|
||||||
|
|
||||||
if (ApplicationProperties.getInstance().calculoPeajeReunidasANTT()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CALCULO_PEAJE_REUNIDAS_ANTT.getDescricao())) {
|
||||||
// (importe * rutaCantEixos) / (indice)
|
// (importe * rutaCantEixos) / (indice)
|
||||||
return importe.multiply(rutaCantEixos)
|
return importe.multiply(rutaCantEixos)
|
||||||
.divide(indice, HIGH_PRECISION, RoundingMode.HALF_UP);
|
.divide(indice, HIGH_PRECISION, RoundingMode.HALF_UP);
|
||||||
|
|
|
@ -45,6 +45,7 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia;
|
import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
|
import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao;
|
||||||
|
@ -1292,7 +1293,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO<Confere
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public Connection getConnection() throws SQLException {
|
public Connection getConnection() throws SQLException {
|
||||||
if (ApplicationProperties.getInstance().isDataSourceComissaoBancoProducao()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.IS_DATASOURCE_COMISSAO_BANCO_PRODUCAO.getDescricao())) {
|
||||||
return dataSource.getConnection();
|
return dataSource.getConnection();
|
||||||
} else {
|
} else {
|
||||||
return dataSourceRead.getConnection();
|
return dataSourceRead.getConnection();
|
||||||
|
|
|
@ -41,6 +41,7 @@ import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ActivoUtil;
|
import com.rjconsultores.ventaboletos.utilerias.ActivoUtil;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +82,7 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
@Override
|
@Override
|
||||||
public Corrida suscribir(final Corrida entity) {
|
public Corrida suscribir(final Corrida entity) {
|
||||||
|
|
||||||
if (ApplicationProperties.getInstance().gerarCampoEquivalenciaCorrida()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GERAR_CAMPO_EQUIVALENCIA_CORRIDA.getDescricao())) {
|
||||||
String sql = "SELECT CORRIDA_EQUIVALENCIA_SEQ.NEXTVAL FROM DUAL";
|
String sql = "SELECT CORRIDA_EQUIVALENCIA_SEQ.NEXTVAL FROM DUAL";
|
||||||
Object o = this.getSession().createSQLQuery(sql).uniqueResult();
|
Object o = this.getSession().createSQLQuery(sql).uniqueResult();
|
||||||
entity.setEquivalenciaId(o.toString());
|
entity.setEquivalenciaId(o.toString());
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
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.CustomDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Custom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Lucas
|
||||||
|
*/
|
||||||
|
@Repository("customDAO")
|
||||||
|
public class CustomHibernateDAO extends GenericHibernateDAO<Custom, Integer>
|
||||||
|
implements CustomDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CustomHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Custom> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Custom buscar(String chave) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
c.add(Restrictions.ilike("chave", chave));
|
||||||
|
|
||||||
|
return (Custom) c.uniqueResult();
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,6 +37,7 @@ import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO;
|
import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO;
|
import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO;
|
||||||
|
@ -413,7 +414,7 @@ public class RutaCombinacionHibernateDAO extends GenericHibernateDAO<RutaCombina
|
||||||
hql.append(" M.MARCA_ID, ");
|
hql.append(" M.MARCA_ID, ");
|
||||||
hql.append(" T.IMPORTETAXAEMBARQUE, ");
|
hql.append(" T.IMPORTETAXAEMBARQUE, ");
|
||||||
hql.append(" T.IMPORTESEGURO, ");
|
hql.append(" T.IMPORTESEGURO, ");
|
||||||
if (ApplicationProperties.getInstance().exibeTpp()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.EXIBE_TPP.getDescricao())) {
|
||||||
hql.append(" T.IMPORTETPP, ");
|
hql.append(" T.IMPORTETPP, ");
|
||||||
}
|
}
|
||||||
hql.append(" T.IMPORTEPEDAGIO, ");
|
hql.append(" T.IMPORTEPEDAGIO, ");
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO;
|
import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO;
|
||||||
|
|
||||||
@Repository("tarifaOficialDAO")
|
@Repository("tarifaOficialDAO")
|
||||||
|
@ -280,7 +281,7 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
||||||
public void atualizarPedagio() {
|
public void atualizarPedagio() {
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
|
|
||||||
if (ApplicationProperties.getInstance().artespPedagioIdaVoltaDivPor2()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.ARTESP_PEDAGIO_IDA_VOLTA_DIV_POR2.getDescricao())) {
|
||||||
sql.append(" merge into tarifa_oficial ");
|
sql.append(" merge into tarifa_oficial ");
|
||||||
sql.append(" using ");
|
sql.append(" using ");
|
||||||
sql.append(" ( ");
|
sql.append(" ( ");
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||||
import com.rjconsultores.ventaboletos.enums.TipoFormapago;
|
import com.rjconsultores.ventaboletos.enums.TipoFormapago;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
|
|
||||||
public class SQLBuilderOracle implements SQLBuilder {
|
public class SQLBuilderOracle implements SQLBuilder {
|
||||||
private static final Integer SELECAO_TODOS = -1;
|
private static final Integer SELECAO_TODOS = -1;
|
||||||
|
@ -344,7 +345,7 @@ public class SQLBuilderOracle implements SQLBuilder {
|
||||||
sb.append(" and mc.activo = 1 ");
|
sb.append(" and mc.activo = 1 ");
|
||||||
sb.append(" and re.activo = 1 ");
|
sb.append(" and re.activo = 1 ");
|
||||||
sb.append(" and r.orgaoconcedente_id <> 21 ");
|
sb.append(" and r.orgaoconcedente_id <> 21 ");
|
||||||
if(ApplicationProperties.getInstance().criarTarifaApenasTrechoVendido()){
|
if(ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CRIAR_TARIFA_APENAS_TRECHO_VENDIDO.getDescricao())){
|
||||||
sb.append(" and rc.indventa = 1 ");
|
sb.append(" and rc.indventa = 1 ");
|
||||||
}
|
}
|
||||||
if (idsEmpresas != null) {
|
if (idsEmpresas != null) {
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
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.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Lucas
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "CUSTOM_SEQ", sequenceName = "CUSTOM_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "CUSTOM")
|
||||||
|
public class Custom implements Serializable {
|
||||||
|
|
||||||
|
public static final Integer TIPO_SISTEMA_CLIENTE = 1;
|
||||||
|
public static final Integer TIPO_SISTEMA_SERVIDOR = 2;
|
||||||
|
public static final Integer TIPO_SISTEMA_ADM = 3;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CUSTOM_SEQ")
|
||||||
|
@Column(name = "CUSTOM_ID")
|
||||||
|
private Integer customId;
|
||||||
|
@Column(name = "SISTEMA")
|
||||||
|
private Integer sistema;
|
||||||
|
@Column(name = "TIPO")
|
||||||
|
private Integer tipo;
|
||||||
|
@Column(name = "ORDEM")
|
||||||
|
private Integer ordem;
|
||||||
|
@Column(name = "REFERENCIA")
|
||||||
|
private String referencia;
|
||||||
|
@Column(name = "CHAVE")
|
||||||
|
private String chave;
|
||||||
|
@Column(name = "VALOR")
|
||||||
|
private String valor;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public Custom() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCustomId() {
|
||||||
|
return customId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomId(Integer customId) {
|
||||||
|
this.customId = customId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSistema() {
|
||||||
|
return sistema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSistema(Integer sistema) {
|
||||||
|
this.sistema = sistema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTipo() {
|
||||||
|
return tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipo(Integer tipo) {
|
||||||
|
this.tipo = tipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrdem() {
|
||||||
|
return ordem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdem(Integer ordem) {
|
||||||
|
this.ordem = ordem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReferencia() {
|
||||||
|
return referencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReferencia(String referencia) {
|
||||||
|
this.referencia = referencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChave() {
|
||||||
|
return chave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChave(String chave) {
|
||||||
|
this.chave = chave;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValor() {
|
||||||
|
return valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValor(String valor) {
|
||||||
|
this.valor = valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 0;
|
||||||
|
hash += (customId != null ? customId.hashCode() : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
if (!(object instanceof Custom)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Custom other = (Custom) object;
|
||||||
|
if ((this.customId == null && other.customId != null) || (this.customId != null && !this.customId.equals(other.customId))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "com.rjconsultores.ventaboletos.entidad.Custom[customId=" + customId + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import org.hibernate.id.Configurable;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
|
|
||||||
public class CustomIdGenerator implements IdentifierGenerator, Configurable {
|
public class CustomIdGenerator implements IdentifierGenerator, Configurable {
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ public class CustomIdGenerator implements IdentifierGenerator, Configurable {
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
Integer id = rs.getInt("NEXTVAL");
|
Integer id = rs.getInt("NEXTVAL");
|
||||||
String newValue = id.toString();
|
String newValue = id.toString();
|
||||||
if (ApplicationProperties.getInstance().habilitarCustomSequence()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.HABILITAR_CUSTOM_SEQUENCE.getDescricao())) {
|
||||||
newValue = "1" + (StringUtils.leftPad(id.toString(), tamanho, "0"));
|
newValue = "1" + (StringUtils.leftPad(id.toString(), tamanho, "0"));
|
||||||
}
|
}
|
||||||
return Integer.valueOf(newValue);
|
return Integer.valueOf(newValue);
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@ -310,7 +311,7 @@ public class Usuario implements Serializable, Authentication, UserDetails {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCredentialsNonExpired() {
|
public boolean isCredentialsNonExpired() {
|
||||||
if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) {
|
||||||
if (getFecContrasena() != null) {
|
if (getFecContrasena() != null) {
|
||||||
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
|
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
|
||||||
Constante contante = constanteService.buscarPorNomeConstante("CANT_DIAS_CONTRASENA");
|
Constante contante = constanteService.buscarPorNomeConstante("CANT_DIAS_CONTRASENA");
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.rjconsultores.ventaboletos.enums;
|
||||||
|
|
||||||
|
public enum SistemaEnum {
|
||||||
|
|
||||||
|
VENDA_CLIENTE(1, "Venda Cliente"),
|
||||||
|
VENDA_SERVIDOR(2, "Venda Servidor"),
|
||||||
|
ADM(3, "Administração");
|
||||||
|
|
||||||
|
private Integer valor;
|
||||||
|
private String descricao;
|
||||||
|
|
||||||
|
private SistemaEnum(Integer valor, String descricao) {
|
||||||
|
this.valor = valor;
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getValor() {
|
||||||
|
return this.valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SistemaEnum getSistema(Integer tValor) {
|
||||||
|
for (SistemaEnum valor : SistemaEnum.values()) {
|
||||||
|
if (valor.getValor().equals(tValor)) {
|
||||||
|
return valor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Custom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Lucas
|
||||||
|
*/
|
||||||
|
public interface CustomService extends GenericService<Custom, Integer> {
|
||||||
|
|
||||||
|
public Custom buscar(String chave);
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* 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.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.CustomDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Custom;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CustomService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Lucas
|
||||||
|
*/
|
||||||
|
@Service("customService")
|
||||||
|
public class CustomServiceImpl implements CustomService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomDAO customDAO;
|
||||||
|
|
||||||
|
public List<Custom> obtenerTodos() {
|
||||||
|
return customDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Custom obtenerID(Integer id) {
|
||||||
|
return customDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS)
|
||||||
|
public Custom suscribir(Custom entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado() != null ? UsuarioLogado.getUsuarioLogado().getUsuarioId() : null);
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return customDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Custom actualizacion(Custom entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return customDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(Custom entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
customDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
|
||||||
|
public Custom buscar(String chave) {
|
||||||
|
return customDAO.buscar(chave);
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,6 +23,7 @@ import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.AutorizaFolioService;
|
import com.rjconsultores.ventaboletos.service.AutorizaFolioService;
|
||||||
import com.rjconsultores.ventaboletos.service.EstacionService;
|
import com.rjconsultores.ventaboletos.service.EstacionService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +97,7 @@ public class EstacionServiceImpl implements EstacionService {
|
||||||
String errorNoChequeFolio = null;
|
String errorNoChequeFolio = null;
|
||||||
for (EstacionImpresora ei : estacion.getLsEstacionImpresora()) {
|
for (EstacionImpresora ei : estacion.getLsEstacionImpresora()) {
|
||||||
boolean isImpressoraFiscal = validacionImpressoraFiscal(ei);
|
boolean isImpressoraFiscal = validacionImpressoraFiscal(ei);
|
||||||
if (ApplicationProperties.getInstance().generarRotinaFolios()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GENERAR_ROTINA_FOLIOS.getDescricao())) {
|
||||||
errorNoChequeFolio = autorizaFolioService.noChequeFolioPreimpresos(ei, false);
|
errorNoChequeFolio = autorizaFolioService.noChequeFolioPreimpresos(ei, false);
|
||||||
} else if ((isImpressoraFiscal && isNuevaFiscal) ||
|
} else if ((isImpressoraFiscal && isNuevaFiscal) ||
|
||||||
(estacion.getIndStockCentral() != null && estacion.getIndStockCentral() && isImpressoraFiscal)) {
|
(estacion.getIndStockCentral() != null && estacion.getIndStockCentral() && isImpressoraFiscal)) {
|
||||||
|
@ -142,7 +143,7 @@ public class EstacionServiceImpl implements EstacionService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ApplicationProperties.getInstance().generarRotinaFolios()) {
|
if (!ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GENERAR_ROTINA_FOLIOS.getDescricao())) {
|
||||||
Estacion estacionPuntoVentaAnterior = estacionDAO.obtenerID(estacion.getEstacionId());
|
Estacion estacionPuntoVentaAnterior = estacionDAO.obtenerID(estacion.getEstacionId());
|
||||||
if (estacionPuntoVentaAnterior.getPuntoVenta() != null)
|
if (estacionPuntoVentaAnterior.getPuntoVenta() != null)
|
||||||
if (!estacionPuntoVentaAnterior.getPuntoVenta().equals(estacion.getPuntoVenta())) {
|
if (!estacionPuntoVentaAnterior.getPuntoVenta().equals(estacion.getPuntoVenta())) {
|
||||||
|
@ -154,7 +155,7 @@ public class EstacionServiceImpl implements EstacionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validarEstoqueBorrar(Estacion estacion) throws BusinessException {
|
private void validarEstoqueBorrar(Estacion estacion) throws BusinessException {
|
||||||
if (!ApplicationProperties.getInstance().generarRotinaFolios()) {
|
if (!ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GENERAR_ROTINA_FOLIOS.getDescricao())) {
|
||||||
if (estacionDAO.temEstoque(estacion.getPuntoVenta(), estacion)) {
|
if (estacionDAO.temEstoque(estacion.getPuntoVenta(), estacion)) {
|
||||||
throw new BusinessException("estacionServiceImpl.msg.hayStock.borrar");
|
throw new BusinessException("estacionServiceImpl.msg.hayStock.borrar");
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
import com.rjconsultores.ventaboletos.service.EstacionService;
|
import com.rjconsultores.ventaboletos.service.EstacionService;
|
||||||
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
import com.rjconsultores.ws.totvs.service.TotvsService;
|
import com.rjconsultores.ws.totvs.service.TotvsService;
|
||||||
import com.rjconsultores.ws.utileria.Atributos;
|
import com.rjconsultores.ws.utileria.Atributos;
|
||||||
|
@ -102,7 +103,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO");
|
Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO");
|
||||||
Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1");
|
Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1");
|
||||||
if (!desativaTotvs){
|
if (!desativaTotvs){
|
||||||
if (ApplicationProperties.getInstance().integracionTotvs()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor())
|
if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor())
|
||||||
|
@ -415,7 +416,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1");
|
Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1");
|
||||||
// desativaTotvs = true;
|
// desativaTotvs = true;
|
||||||
if (!desativaTotvs){
|
if (!desativaTotvs){
|
||||||
if (ApplicationProperties.getInstance().integracionTotvs()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor())
|
if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor())
|
||||||
|
@ -616,7 +617,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String integracionTotvs(PuntoVenta puntoVenta) throws Exception {
|
private String integracionTotvs(PuntoVenta puntoVenta) throws Exception {
|
||||||
if (ApplicationProperties.getInstance().integracionTotvs()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) {
|
||||||
|
|
||||||
validaCampos(puntoVenta);
|
validaCampos(puntoVenta);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.rjconsultores.ventaboletos.exception.ValidacionCampoException;
|
||||||
import com.rjconsultores.ventaboletos.service.EventoExtraService;
|
import com.rjconsultores.ventaboletos.service.EventoExtraService;
|
||||||
import com.rjconsultores.ventaboletos.service.TipoEventoExtraService;
|
import com.rjconsultores.ventaboletos.service.TipoEventoExtraService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +47,7 @@ public class TipoEventoExtraServiceImpl implements TipoEventoExtraService {
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.TRUE);
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
if (ApplicationProperties.getInstance().integracionTotvs()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) {
|
||||||
validaCampos(entidad);
|
validaCampos(entidad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ public class TipoEventoExtraServiceImpl implements TipoEventoExtraService {
|
||||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
entidad.setActivo(Boolean.TRUE);
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
if (ApplicationProperties.getInstance().integracionTotvs()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) {
|
||||||
validaCampos(entidad);
|
validaCampos(entidad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.seguridad.ContrasenaUtileria;
|
import com.rjconsultores.ventaboletos.utilerias.seguridad.ContrasenaUtileria;
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
}
|
}
|
||||||
if (senha != null) {
|
if (senha != null) {
|
||||||
// validación complejidad contrasena
|
// validación complejidad contrasena
|
||||||
if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) {
|
||||||
ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria();
|
ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria();
|
||||||
contrasenaUtileria.validarContrasenaCompleja(senha);
|
contrasenaUtileria.validarContrasenaCompleja(senha);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +140,7 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
}
|
}
|
||||||
if (senha != null) {
|
if (senha != null) {
|
||||||
// validación complejidad contrasena
|
// validación complejidad contrasena
|
||||||
if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) {
|
||||||
ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria();
|
ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria();
|
||||||
contrasenaUtileria.validarContrasenaCompleja(senha);
|
contrasenaUtileria.validarContrasenaCompleja(senha);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +197,7 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService {
|
||||||
|
|
||||||
Usuario user = list.get(0);
|
Usuario user = list.get(0);
|
||||||
|
|
||||||
if (ApplicationProperties.getInstance().contrasenaValidaComplejidad()) {
|
if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) {
|
||||||
if (!user.isCredentialsNonExpired()) {
|
if (!user.isCredentialsNonExpired()) {
|
||||||
throw new CredentialsExpiredException("Senha Expirada");
|
throw new CredentialsExpiredException("Senha Expirada");
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,20 +11,35 @@ import java.util.Properties;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Custom;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CustomService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clase con las propriedad especificas de los clientes
|
* Clase con las propriedad especificas de los clientes
|
||||||
*
|
*
|
||||||
* @author Administrador
|
* @author Administrador
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ApplicationProperties {
|
public class ApplicationProperties {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(ApplicationProperties.class);
|
private static Logger log = Logger.getLogger(ApplicationProperties.class);
|
||||||
private static ApplicationProperties INSTANCE;
|
private static ApplicationProperties INSTANCE;
|
||||||
private static Properties p;
|
private static Properties p;
|
||||||
|
|
||||||
private ApplicationProperties() {
|
private ApplicationProperties() {
|
||||||
p = new Properties();
|
p = new Properties();
|
||||||
this.readConfiguration();
|
this.readConfiguration();
|
||||||
|
this.readConfigurationToDatabase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationProperties getInstance() {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
INSTANCE = new ApplicationProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readConfiguration() {
|
private void readConfiguration() {
|
||||||
|
@ -37,266 +52,77 @@ public class ApplicationProperties {
|
||||||
log.error(e);
|
log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insere na tabela de custom os registros que existem no Enum, o valor inicial ao inserir de cada custom é baseado no arquivo de propriedades
|
||||||
|
* {@code database.properties}, caso não exista é inserido com valor {@code null}. A cada novo parâmetro no Enum será adicionado um registro na tabela de custom. Não deverá mais ser adicionado
|
||||||
|
* mais informações no arquivo de propriedades, somente no Enum {@code CustomEnum}.
|
||||||
|
* @see #CustomEnum
|
||||||
|
*/
|
||||||
|
public void readConfigurationToDatabase() {
|
||||||
|
|
||||||
public static ApplicationProperties getInstance() {
|
try {
|
||||||
if (INSTANCE == null) {
|
CustomService customService = (CustomService) AppContext.getApplicationContext().getBean("customService");
|
||||||
INSTANCE = new ApplicationProperties();
|
for (CustomEnum customEnum : CustomEnum.values()) {
|
||||||
|
if (customService.buscar(customEnum.toString()) == null) {
|
||||||
|
|
||||||
|
Custom custom = new Custom();
|
||||||
|
custom.setChave(customEnum.toString());
|
||||||
|
custom.setValor(p.getProperty(customEnum.toString()));
|
||||||
|
custom.setSistema(Custom.TIPO_SISTEMA_ADM);
|
||||||
|
customService.suscribir(custom);
|
||||||
|
|
||||||
|
log.info("Adicionado custom=" + customEnum.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getValuefromCustom(String key, String defaultValue) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
CustomService customService = (CustomService) AppContext.getApplicationContext().getBean("customService");
|
||||||
|
Custom custom = customService.buscar(key);
|
||||||
|
if (custom != null) {
|
||||||
|
String val = custom.getValor();
|
||||||
|
return (val == null) ? defaultValue : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return INSTANCE;
|
return defaultValue;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indica se la informacion de equivalencia es visible
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean mostrarEquivalencia() {
|
|
||||||
String property = p.getProperty("equivalencia.mostrar", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indica se o campo empresa é obrigatório
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean empresaObrigatoria() {
|
|
||||||
String property = p.getProperty("empresa.obrigatoria", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indica se es gerado o campo equivalencia corrida na tabela de corrida
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean gerarCampoEquivalenciaCorrida() {
|
|
||||||
String property = p.getProperty("corrida.gerarCampoEquivalencia", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indica exibe o combo de Division na Gera��o de Corridas do Esquema Operacional.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean exibirDivisionConfiguracionCorrida() {
|
|
||||||
String property = p.getProperty("esquemaOperacional.configuracionCorrida.exibeDivision", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indica se va a exhibir la cuenta contable en el catalogo de tipos de eventos
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean exhibirCuentaContableTiposEventos() {
|
|
||||||
String property = p.getProperty("eventosExtras.tiposEventos.exhibirCuentaContable", "1");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indica se va a exhibir la "aba" de excepciones de tramo_km en la pantalla de tramos
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean exhibirExcepcionesTramoKm() {
|
|
||||||
String property = p.getProperty("tramos.exhibirExcepcionesTramoKm", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indica se vai exibir botão na modificação massiva de tarifa de geração automatica de tarifas
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean generarTarifasAutomatica() {
|
|
||||||
String property = p.getProperty("tarifa.generarTarifasAutomatica", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean generarRotinaFolios() {
|
|
||||||
String property = p.getProperty("no.cheque.folio", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean habilitarPricingCategoria() {
|
|
||||||
String property = p.getProperty("pricing.categoria.habilitar", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean rutaConMasDeUnaClase() {
|
|
||||||
String property = p.getProperty("ruta.masdeunaclase", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean diagramaAutobusDosPestana() {
|
|
||||||
String property = p.getProperty("diagramaautobus.dospestana", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean contrasenaValidaComplejidad() {
|
|
||||||
String property = p.getProperty("contrasena.validaComplejidad", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean habilitarCustomSequence() {
|
|
||||||
String property = p.getProperty("custom.sequence", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean integracionTotvs() {
|
|
||||||
String property = p.getProperty("integracion.totvs", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean integracionAG() {
|
|
||||||
String property = p.getProperty("integracion.AG", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean integracionAGWS() {
|
|
||||||
String property = p.getProperty("integracion.agws", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean integracionRioCard() {
|
|
||||||
String property = p.getProperty("integracion.riocard", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean diagramaAutobusTrem() {
|
|
||||||
String property = p.getProperty("layoutdiagramaautobus.trem", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean validaEstadoNoNomeLocalidade() {
|
|
||||||
String property = p.getProperty("validaEstadoNomeLocalidade", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean podeEditarClienteFidelidade() {
|
|
||||||
String property = p.getProperty("podeEditarClienteFidelidade", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean validaSobreposicaoVigencia() {
|
|
||||||
String property = p.getProperty("validaSobreposicaoVigencia", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean usaCPFComoFidelidade(){
|
|
||||||
String property = p.getProperty("usaCPFComoFidelidade", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean usaPadraoPricingTipoPassagemPET(){
|
|
||||||
String property = p.getProperty("usaPadroPricingEspecificoTipoPassagemPET", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean exibeTpp() {
|
|
||||||
String property = p.getProperty("exibeTpp", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean codAnttNaoObrigatorio() {
|
|
||||||
String property = p.getProperty("codAnttNaoObrigatorio", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean artespPedagioIdaVoltaDivPor2() {
|
|
||||||
String property = p.getProperty("artespPedagioIdaVoltaDivPor2", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean calculoPeajeReunidasANTT() {
|
|
||||||
String property = p.getProperty("calculoPeajeReunidasANTT", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer maxSizeNumCorrida() {
|
public Integer maxSizeNumCorrida() {
|
||||||
String property = p.getProperty("maxSizeNumCorrida", "-1");
|
String property = getValuefromCustom(CustomEnum.MAX_SIZE_NUM_CORRIDA.toString(), "-1");
|
||||||
return Integer.parseInt(property);
|
return Integer.parseInt(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean criarTarifaApenasTrechoVendido() {
|
|
||||||
String property = p.getProperty("criarTarifaApenasTrechoVendido", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean exibirEstacaoCadastroUsuario() {
|
|
||||||
String property = p.getProperty("exibirEstacaoCadastroUsuario", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean utillizaCartaoLiberCard() {
|
|
||||||
String property = p.getProperty("utilizaLibercard", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Procura a chave no banco de dados, caso exista retorna o valor, caso não exista retorna 0.
|
||||||
* Indica se ao salvar um ponto de venda será validado se para todas as empresas informadas para venda também será necessário informar o fechamento.
|
*
|
||||||
*
|
* @param key o valor da chave.
|
||||||
* @return
|
* @return o valor do custom no banco.
|
||||||
*/
|
*/
|
||||||
public boolean validaContaCorrenteEmpesaPtoVta() {
|
public boolean isCustomHabilitado(String key) {
|
||||||
String property = p.getProperty("puntoVenta.validaCtaCteEmpresa", "1");
|
String property = getValuefromCustom(key, "0");
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDataSourceComissaoBancoProducao() {
|
|
||||||
String property = p.getProperty("datasource.conferencia.comissao", "0");
|
|
||||||
return property.equals("0");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPermiteVariasImpressorasMesmaEmpresa() {
|
|
||||||
String property = p.getProperty("permiteVariasImpressorasMesmaEmpresa", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFormaPagoPricingInativo() {
|
|
||||||
String property = p.getProperty("formaPagoPricingInativo", "1");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean exibirPuntoVentaCadastroAIDF() {
|
|
||||||
String property = p.getProperty("exibirPuntoVentaCadastroAIDF", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
public boolean isPuntoVentaCadastroAIDFObrigatorio() {
|
|
||||||
String property = p.getProperty("puntoVentaCadastroAIDFObrigatorio", "0");
|
|
||||||
return property.equals("1");
|
return property.equals("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enderecoClienteObrigatorio() {
|
/**
|
||||||
String property = p.getProperty("cliente.enderecoObrigatorio", "1");
|
* Procura a chave no banco de dados, caso exista retorna o valor, caso não exista retorna o valor default.
|
||||||
return property.equals("1");
|
*
|
||||||
}
|
* @param key o valor da chave.
|
||||||
|
* @return o valor do custom no banco.
|
||||||
public boolean isPermiteLayoutInternacional() {
|
*/
|
||||||
String property = p.getProperty("permiteLayoutInternacional", "0");
|
public boolean isCustomHabilitado(String key, String defaultValue) {
|
||||||
return property.equals("1");
|
String property = getValuefromCustom(key, defaultValue);
|
||||||
}
|
|
||||||
|
|
||||||
public boolean relatorioTaxasLinhaTxtDownloadVisible() {
|
|
||||||
String property = p.getProperty("taxasLinhaTxtDownloadVisible", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPermiteCalculoComissaoPeriodo() {
|
|
||||||
String property = p.getProperty("permiteCalculoComissaoPeriodo", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIncluiTipoPagamentoTurismoBGM() {
|
|
||||||
String property = p.getProperty("incluiTipoPagamentoTurismoBGM", "0");
|
|
||||||
return property.equals("1");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGerarTrechoAutomaticoDefaultNao() {
|
|
||||||
String property = p.getProperty("gerarTrechoAutomaticoDefaultNao", "0");
|
|
||||||
return property.equals("1");
|
return property.equals("1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
package com.rjconsultores.ventaboletos.utilerias;
|
||||||
|
|
||||||
|
public enum CustomEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica se la informacion de equivalencia es visible
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
MOSTRAR_EQUIVALENCIA("equivalencia.mostrar"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica se o campo empresa é obrigatório
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EMPRESA_OBRIGATORIA("empresa.obrigatoria"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica se es gerado o campo equivalencia corrida na tabela de corrida
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
GERAR_CAMPO_EQUIVALENCIA_CORRIDA("corrida.gerarCampoEquivalencia"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica exibe o combo de Division na Gera��o de Corridas do Esquema Operacional.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EXIBIR_DIVISION_CONFIGURACION_CORRIDA("esquemaOperacional.configuracionCorrida.exibeDivision"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica se va a exhibir la cuenta contable en el catalogo de tipos de eventos
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EXHIBIR_CUENTA_CONTABLE_TIPOS_EVENTOS("eventosExtras.tiposEventos.exhibirCuentaContable"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica se va a exhibir la "aba" de excepciones de tramo_km en la pantalla de tramos
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
EXHIBIR_EXCEPCIONES_TRAMO_KM("tramos.exhibirExcepcionesTramoKm"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica se vai exibir botão na modificação massiva de tarifa de geração automatica de tarifas
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
GENERAR_TARIFAS_AUTOMATICA("tarifa.generarTarifasAutomatica"),
|
||||||
|
|
||||||
|
GENERAR_ROTINA_FOLIOS("no.cheque.folio"),
|
||||||
|
|
||||||
|
HABILITAR_PRICING_CATEGORIA("pricing.categoria.habilitar"),
|
||||||
|
|
||||||
|
RUTA_CON_MAS_DE_UNA_CLASE("ruta.masdeunaclase"),
|
||||||
|
|
||||||
|
DIAGRAMA_AUTOBUS_DOS_PESTANA("diagramaautobus.dospestana"),
|
||||||
|
|
||||||
|
CONTRASENA_VALIDA_COMPLEJIDAD("contrasena.validaComplejidad"),
|
||||||
|
|
||||||
|
HABILITAR_CUSTOM_SEQUENCE("custom.sequence"),
|
||||||
|
|
||||||
|
INTEGRACION_TOTVS("integracion.totvs"),
|
||||||
|
|
||||||
|
INTEGRACION_AG("integracion.AG"),
|
||||||
|
|
||||||
|
INTEGRACION_AGWS("integracion.agws"),
|
||||||
|
|
||||||
|
INTEGRACION_RIOCARD("integracion.riocard"),
|
||||||
|
|
||||||
|
DIAGRAMA_AUTOBUS_TREM("layoutdiagramaautobus.trem"),
|
||||||
|
|
||||||
|
VALIDA_ESTADO_NO_NOME_LOCALIDADE("validaEstadoNomeLocalidade"),
|
||||||
|
|
||||||
|
PODE_EDITAR_CLIENTE_FIDELIDADE("podeEditarClienteFidelidade"),
|
||||||
|
|
||||||
|
VALIDA_SOBREPOSICAO_VIGENCIA("validaSobreposicaoVigencia"),
|
||||||
|
|
||||||
|
USA_CPF_COMO_FIDELIDADE("usaCPFComoFidelidade"),
|
||||||
|
|
||||||
|
USA_PADRAO_PRICING_TIPO_PASSAGEM_PET("usaPadroPricingEspecificoTipoPassagemPET"),
|
||||||
|
|
||||||
|
EXIBE_TPP("exibeTpp"),
|
||||||
|
|
||||||
|
COD_ANTT_NAO_OBRIGATORIO("codAnttNaoObrigatorio"),
|
||||||
|
|
||||||
|
ARTESP_PEDAGIO_IDA_VOLTA_DIV_POR2("artespPedagioIdaVoltaDivPor2"),
|
||||||
|
|
||||||
|
CALCULO_PEAJE_REUNIDAS_ANTT("calculoPeajeReunidasANTT"),
|
||||||
|
|
||||||
|
MAX_SIZE_NUM_CORRIDA("maxSizeNumCorrida"),
|
||||||
|
|
||||||
|
CRIAR_TARIFA_APENAS_TRECHO_VENDIDO("criarTarifaApenasTrechoVendido"),
|
||||||
|
|
||||||
|
EXIBIR_ESTACAO_CADASTRO_USUARIO("exibirEstacaoCadastroUsuario"),
|
||||||
|
|
||||||
|
UTILLIZA_CARTAO_LIBERCARD("utilizaLibercard"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Indica se ao salvar um ponto de venda será validado se para todas as empresas informadas para venda também será necessário informar o fechamento.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
VALIDA_CONTA_CORRENTE_EMPESA_PTOVTA("puntoVenta.validaCtaCteEmpresa"),
|
||||||
|
|
||||||
|
IS_DATASOURCE_COMISSAO_BANCO_PRODUCAO("datasource.conferencia.comissao"),
|
||||||
|
|
||||||
|
IS_PERMITE_VARIAS_IMPRESSORAS_MESMA_EMPRESA("permiteVariasImpressorasMesmaEmpresa"),
|
||||||
|
|
||||||
|
IS_FORMAPAGO_PRICING_INATIVO("formaPagoPricingInativo"),
|
||||||
|
|
||||||
|
EXIBIR_PUNTO_VENTA_CADASTRO_AIDF("exibirPuntoVentaCadastroAIDF"),
|
||||||
|
|
||||||
|
IS_PUNTOVENTA_CADASTRO_AIDF_OBRIGATORIO("isPuntoVentaCadastroAIDFObrigatorio"),
|
||||||
|
|
||||||
|
ENDERECO_CLIENTE_OBRIGATORIO("cliente.enderecoObrigatorio"),
|
||||||
|
|
||||||
|
IS_PERMITE_LAYOUT_INTERNACIONAL("permiteLayoutInternacional"),
|
||||||
|
|
||||||
|
RELATORIO_TAXAS_LINHA_TXT_DOWNLOAD_VISIBLE("taxasLinhaTxtDownloadVisible"),
|
||||||
|
|
||||||
|
IS_PERMITE_CALCULO_COMISSAO_PERIODO("permiteCalculoComissaoPeriodo"),
|
||||||
|
|
||||||
|
IS_INCLUI_TIPO_PAGAMENTO_TURISMO_BGM("incluiTipoPagamentoTurismoBGM"),
|
||||||
|
|
||||||
|
IS_GERAR_TRECHO_AUTOMATICO_DEFAULT_NAO("gerarTrechoAutomaticoDefaultNao"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private String descricao;
|
||||||
|
|
||||||
|
private CustomEnum(String descricao) {
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescricao() {
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue