fixes bug#JIRA-38
dev:julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@114150 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
75c65c5fa5
commit
f7126a48e2
|
@ -0,0 +1,14 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce;
|
||||||
|
|
||||||
|
public interface EmpresaEmailEComerceDAO extends GenericDAO<EmpresaEmailEComerce, Integer> {
|
||||||
|
|
||||||
|
public List<EmpresaEmailEComerce> obtenerTodos();
|
||||||
|
|
||||||
|
public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
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.EmpresaEmailEComerceDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce;
|
||||||
|
|
||||||
|
@Repository("empresaEmailEComerceDAO")
|
||||||
|
public class EmpresaEmailEComerceHibernateDAO extends GenericHibernateDAO<EmpresaEmailEComerce, Integer>
|
||||||
|
implements EmpresaEmailEComerceDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public EmpresaEmailEComerceHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EmpresaEmailEComerce> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("empresa", empresa));
|
||||||
|
c.add(Restrictions.eq("tipoOperacao", tipoOperacao));
|
||||||
|
|
||||||
|
return (EmpresaEmailEComerce) c.uniqueResult();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,248 @@
|
||||||
|
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_EMAIL_ECOMERCE_SEQ", sequenceName = "EMPRESA_EMAIL_ECOMERCE_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "EMPRESA_EMAIL_ECOMERCE")
|
||||||
|
public class EmpresaEmailEComerce implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_EMAIL_ECOMERCE_SEQ")
|
||||||
|
@Column(name = "EMPRESAEMAILECOMERCE_ID")
|
||||||
|
private Integer empresaEmailEComerceId;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "EMPRESA_ID")
|
||||||
|
private Empresa empresa;
|
||||||
|
@Column(name = "SMTP")
|
||||||
|
private String smtp;
|
||||||
|
@Column(name = "SENHA")
|
||||||
|
private String senha;
|
||||||
|
@Column(name = "SMTPPORTA")
|
||||||
|
private String smtpPorta;
|
||||||
|
@Column(name = "SMTPEMAIL")
|
||||||
|
private String smtpEmail;
|
||||||
|
@Column(name = "TEXTOEMAIL")
|
||||||
|
private String textoEmail;
|
||||||
|
@Column(name = "TEXTOCUPOMEMBARQUE")
|
||||||
|
private String textoCupomEmbarque;
|
||||||
|
@Column(name = "ASSUNTO")
|
||||||
|
private String assunto;
|
||||||
|
@Column(name = "EMAILDE")
|
||||||
|
private String emailDe;
|
||||||
|
@Column(name = "EMAILCOPIAOCULTA")
|
||||||
|
private String emailCopiaOculta;
|
||||||
|
@Column(name = "TIPOOPERACAO")
|
||||||
|
private String tipoOperacao;
|
||||||
|
@Column(name = "TIPOAUTORIZACAO")
|
||||||
|
private String tipoAutorizacao;
|
||||||
|
@Column(name = "INDAUTENTICACAO")
|
||||||
|
private Boolean indAutenticacao;
|
||||||
|
|
||||||
|
@Column(name = "ANEXO1")
|
||||||
|
private String anexo1;
|
||||||
|
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public EmpresaEmailEComerce() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEmpresaEmailEComerceId() {
|
||||||
|
return empresaEmailEComerceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaEmailEComerceId(Integer empresaEmailEComerceId) {
|
||||||
|
this.empresaEmailEComerceId = empresaEmailEComerceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Empresa getEmpresa() {
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresa(Empresa empresa) {
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSmtp() {
|
||||||
|
return smtp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtp(String smtp) {
|
||||||
|
this.smtp = smtp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSenha() {
|
||||||
|
return senha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSenha(String senha) {
|
||||||
|
this.senha = senha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSmtpPorta() {
|
||||||
|
return smtpPorta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtpPorta(String smtpPorta) {
|
||||||
|
this.smtpPorta = smtpPorta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSmtpEmail() {
|
||||||
|
return smtpEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmtpEmail(String smtpEmail) {
|
||||||
|
this.smtpEmail = smtpEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTextoEmail() {
|
||||||
|
return textoEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextoEmail(String textoEmail) {
|
||||||
|
this.textoEmail = textoEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTextoCupomEmbarque() {
|
||||||
|
return textoCupomEmbarque;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextoCupomEmbarque(String textoCupomEmbarque) {
|
||||||
|
this.textoCupomEmbarque = textoCupomEmbarque;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAssunto() {
|
||||||
|
return assunto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAssunto(String assunto) {
|
||||||
|
this.assunto = assunto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmailDe() {
|
||||||
|
return emailDe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailDe(String emailDe) {
|
||||||
|
this.emailDe = emailDe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmailCopiaOculta() {
|
||||||
|
return emailCopiaOculta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailCopiaOculta(String emailCopiaOculta) {
|
||||||
|
this.emailCopiaOculta = emailCopiaOculta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoOperacao() {
|
||||||
|
return tipoOperacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoOperacao(String tipoOperacao) {
|
||||||
|
this.tipoOperacao = tipoOperacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoAutorizacao() {
|
||||||
|
return tipoAutorizacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoAutorizacao(String tipoAutorizacao) {
|
||||||
|
this.tipoAutorizacao = tipoAutorizacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndAutenticacao() {
|
||||||
|
return indAutenticacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndAutenticacao(Boolean indAutenticacao) {
|
||||||
|
this.indAutenticacao = indAutenticacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAnexo1() {
|
||||||
|
return anexo1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnexo1(String anexo1) {
|
||||||
|
this.anexo1 = anexo1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result
|
||||||
|
+ ((empresaEmailEComerceId == null) ? 0 : empresaEmailEComerceId.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;
|
||||||
|
EmpresaEmailEComerce other = (EmpresaEmailEComerce) obj;
|
||||||
|
if (empresaEmailEComerceId == null) {
|
||||||
|
if (other.empresaEmailEComerceId != null)
|
||||||
|
return false;
|
||||||
|
} else if (!empresaEmailEComerceId.equals(other.empresaEmailEComerceId))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(this.getEmpresaEmailEComerceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.rjconsultores.ventaboletos.enums;
|
||||||
|
|
||||||
|
public enum TipoEmail {
|
||||||
|
|
||||||
|
CALL_CENTER(1, "Call Center"),
|
||||||
|
ECOMMERCE(2, "E-Commerce"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String descricao;
|
||||||
|
|
||||||
|
private TipoEmail(Integer id, String descricao) {
|
||||||
|
this.descricao = descricao;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescricao() {
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescricao(String descricao) {
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TipoEmail buscarPorId(Integer id) {
|
||||||
|
for (TipoEmail ids : TipoEmail.values()) {
|
||||||
|
if (ids.getId() == id) {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.rjconsultores.ventaboletos.enums;
|
||||||
|
|
||||||
|
public enum TipoOperacaoECommerce {
|
||||||
|
|
||||||
|
CADASTRO_CLIENTE(1, "Cadastro Cliente"),
|
||||||
|
ESQUECER_SENHA(2, "Esquecer Senha"),
|
||||||
|
COMPRA_PASSAGEM(3, "Compra de passagem"),
|
||||||
|
COMPRA_CANCELAMENTO(4, "Cancelamento de compra"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String descricao;
|
||||||
|
|
||||||
|
private TipoOperacaoECommerce(Integer id, String descricao) {
|
||||||
|
this.descricao = descricao;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescricao() {
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescricao(String descricao) {
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TipoOperacaoECommerce buscarPorId(Integer id) {
|
||||||
|
for (TipoOperacaoECommerce ids : TipoOperacaoECommerce.values()) {
|
||||||
|
if (ids.getId() == id) {
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce;
|
||||||
|
|
||||||
|
public interface EmpresaEmailEComerceService extends GenericService<EmpresaEmailEComerce, Integer> {
|
||||||
|
|
||||||
|
public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao);
|
||||||
|
|
||||||
|
}
|
|
@ -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.EmpresaEmailEComerceDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaEmailEComerceService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("empresaEmailEComerceService")
|
||||||
|
public class EmpresaEmailEComerceServiceImpl implements EmpresaEmailEComerceService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmpresaEmailEComerceDAO empresaEmailEComerceDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EmpresaEmailEComerce> obtenerTodos() {
|
||||||
|
return empresaEmailEComerceDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmpresaEmailEComerce obtenerID(Integer id) {
|
||||||
|
return empresaEmailEComerceDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public EmpresaEmailEComerce suscribir(EmpresaEmailEComerce entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return empresaEmailEComerceDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public EmpresaEmailEComerce actualizacion(EmpresaEmailEComerce entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return empresaEmailEComerceDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void borrar(EmpresaEmailEComerce entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
empresaEmailEComerceDAO.actualizacion(entidad);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao) {
|
||||||
|
return empresaEmailEComerceDAO.buscarPorEmpresa(empresa, tipoOperacao);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue