fixes bug#23184

dev:lucas

qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@109163 d1611594-4594-4d17-8e1d-87c2c4800839
master
lucas.taia 2021-10-15 18:36:10 +00:00
parent e540e97614
commit 2c0844d609
7 changed files with 303 additions and 1 deletions

View File

@ -0,0 +1,14 @@
package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig;
public interface EmpresaSaferConfigDAO extends GenericDAO<EmpresaSaferConfig, Integer> {
public List<EmpresaSaferConfig> obtenerTodos();
public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa);
}

View File

@ -0,0 +1,41 @@
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.EmpresaSaferConfigDAO;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig;
@Repository("empresaSaferConfigDAO")
public class EmpresaSaferConfigHibernateDAO extends GenericHibernateDAO<EmpresaSaferConfig, Integer>
implements EmpresaSaferConfigDAO {
@Autowired
public EmpresaSaferConfigHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
@Override
public List<EmpresaSaferConfig> obtenerTodos() {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
return c.list();
}
@Override
public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("empresa", empresa));
return (EmpresaSaferConfig) c.uniqueResult();
}
}

View File

@ -0,0 +1,157 @@
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;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@SequenceGenerator(name = "EMPRESA_SAFER_CONFIG_SEQ", sequenceName = "EMPRESA_SAFER_CONFIG_SEQ", allocationSize = 1)
@Table(name = "EMPRESA_SAFER_CONFIG")
public class EmpresaSaferConfig implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_SAFER_CONFIG_SEQ")
@Column(name = "EMPRESASAFERCONFIG_ID")
private Integer empresaSaferConfigId;
@Column(name = "PARTNERID")
private String partnerId;
@Column(name = "CONTRACTID")
private String contractId;
@Column(name = "SENHA")
private String senha;
@Column(name = "CERTIFICADO")
private byte[] certificado;
@OneToOne
@JoinColumn(name = "EMPRESA_ID")
private Empresa empresa;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
public EmpresaSaferConfig() {
}
public Integer getEmpresaSaferConfigId() {
return empresaSaferConfigId;
}
public void setEmpresaSaferConfigId(Integer empresaSaferConfigId) {
this.empresaSaferConfigId = empresaSaferConfigId;
}
public String getPartnerId() {
return partnerId;
}
public void setPartnerId(String partnerId) {
this.partnerId = partnerId;
}
public String getContractId() {
return contractId;
}
public void setContractId(String contractId) {
this.contractId = contractId;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public byte[] getCertificado() {
return certificado;
}
public void setCertificado(byte[] certificado) {
this.certificado = certificado;
}
public Empresa getEmpresa() {
return empresa;
}
public void setEmpresa(Empresa empresa) {
this.empresa = empresa;
}
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() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((empresaSaferConfigId == null) ? 0 : empresaSaferConfigId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EmpresaSaferConfig other = (EmpresaSaferConfig) obj;
if (empresaSaferConfigId == null) {
if (other.empresaSaferConfigId != null)
return false;
} else if (!empresaSaferConfigId.equals(other.empresaSaferConfigId))
return false;
return true;
}
@Override
public String toString() {
return String.valueOf(this.getEmpresaSaferConfigId());
}
}

View File

@ -119,6 +119,9 @@ public class Pricing implements Serializable {
@Column(name = "INDPRICINGDIVIDIRIDAEVOLTA")
private Boolean indPricingDividirIdaEVolta;
@Column(name = "INDSAFER")
private Boolean indSafer;
public enum GerarFeriado {
// Declaração dos enum
@ -560,4 +563,12 @@ public class Pricing implements Serializable {
this.indPricingDividirIdaEVolta = indPricingDividirIdaEVolta;
}
public Boolean getIndSafer() {
return indSafer;
}
public void setIndSafer(Boolean indSafer) {
this.indSafer = indSafer;
}
}

View File

@ -0,0 +1,9 @@
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig;
public interface EmpresaSaferConfigService extends GenericService<EmpresaSaferConfig, Integer> {
public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa);
}

View File

@ -0,0 +1,68 @@
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.EmpresaSaferConfigDAO;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig;
import com.rjconsultores.ventaboletos.service.EmpresaSaferConfigService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("empresaSaferConfigService")
public class EmpresaSaferConfigServiceImpl implements EmpresaSaferConfigService {
@Autowired
private EmpresaSaferConfigDAO empresaSaferConfigDAO;
@Override
public List<EmpresaSaferConfig> obtenerTodos() {
return empresaSaferConfigDAO.obtenerTodos();
}
@Override
public EmpresaSaferConfig obtenerID(Integer id) {
return empresaSaferConfigDAO.obtenerID(id);
}
@Override
@Transactional
public EmpresaSaferConfig suscribir(EmpresaSaferConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return empresaSaferConfigDAO.suscribir(entidad);
}
@Override
@Transactional
public EmpresaSaferConfig actualizacion(EmpresaSaferConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return empresaSaferConfigDAO.actualizacion(entidad);
}
@Override
@Transactional
public void borrar(EmpresaSaferConfig entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
empresaSaferConfigDAO.actualizacion(entidad);
}
@Override
public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa) {
return empresaSaferConfigDAO.buscarPorEmpresa(empresa);
}
}

View File

@ -151,7 +151,9 @@ public enum CustomEnum {
IS_VALIDAR_CONSTANTE_REMESSA("isValidarConstanteRemessa"),
IS_DESABILITA_USUARIO_ADMINISTRADORES_PERFIL("dasabilitaUsuarioAdministradoresPerfil");
IS_DESABILITA_USUARIO_ADMINISTRADORES_PERFIL("dasabilitaUsuarioAdministradoresPerfil"),
INTEGRACION_SAFER("integracion.safer");
private String descricao;