From 212f5514fc6e3be458f3f7f91af1cb5e4b007ff9 Mon Sep 17 00:00:00 2001 From: carla Date: Thu, 1 Nov 2012 16:54:22 +0000 Subject: [PATCH] =?UTF-8?q?Cria=C3=A7=C3=A3o=20tela=20cadastro=20do=20sife?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@22353 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/entidad/Estacion.java | 17 ++ .../ventaboletos/entidad/EstacionSitef.java | 156 ++++++++++++++++++ .../ventaboletos/entidad/PuntoVenta.java | 8 +- .../service/impl/EstacionServiceImpl.java | 6 + .../service/impl/PuntoVentaServiceImpl.java | 33 ++++ 5 files changed, 216 insertions(+), 4 deletions(-) create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java diff --git a/src/com/rjconsultores/ventaboletos/entidad/Estacion.java b/src/com/rjconsultores/ventaboletos/entidad/Estacion.java index 7d47b5e81..c55b57983 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Estacion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Estacion.java @@ -7,12 +7,14 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; +import javax.persistence.CascadeType; 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.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; @@ -68,12 +70,18 @@ public class Estacion implements Serializable { private String nomeArquivoLayout; @Column(name = "NOMEIMPRESSORARELATORIO") private String nomeImpressoraRelatorio; + + @JoinColumn(name = "ESTACIONSITEF_ID") + @ManyToOne(cascade=CascadeType.ALL) + private EstacionSitef estacionSitefId; public Estacion() { + this.estacionSitefId = new EstacionSitef(); } public Estacion(Integer estacionId) { this.estacionId = estacionId; + } public Integer getEstacionId() { @@ -188,6 +196,15 @@ public class Estacion implements Serializable { this.nomeImpressoraRelatorio = nomeImpressoraRelatorio; } + + public EstacionSitef getEstacionSitefId() { + return estacionSitefId; + } + + public void setEstacionSitefId(EstacionSitef estacionSitefId) { + this.estacionSitefId = estacionSitefId; + } + @Override public int hashCode() { int hash = 0; diff --git a/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java new file mode 100644 index 000000000..b18269a10 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java @@ -0,0 +1,156 @@ +/* + * 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 java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author RJ + */ +@Entity +@Table(name = "ESTACION_SITEF") +@SequenceGenerator(name = "ESTACION_SITEF_SEQ", sequenceName = "ESTACION_SITEF_SEQ", allocationSize = 1) +public class EstacionSitef implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_SITEF_SEQ") + @Column(name = "ESTACIONSITEF_ID") + private Integer estacionsitefId; + @Column(name = "NUMEMPRESA") + private Integer numempresa; + @Column(name = "NUMFILIAL") + private Integer numfilial; + @Column(name = "NUMPDV") + private Integer numpdv; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "estacionSitefId") + private List estacionList; + + public EstacionSitef() { + } + + public EstacionSitef(Integer estacionsitefId) { + this.estacionsitefId = estacionsitefId; + } + + public Integer getEstacionsitefId() { + return estacionsitefId; + } + + public void setEstacionsitefId(Integer estacionsitefId) { + this.estacionsitefId = estacionsitefId; + } + + public Integer getNumempresa() { + return numempresa; + } + + public void setNumempresa(Integer numempresa) { + this.numempresa = numempresa; + } + + public Integer getNumfilial() { + return numfilial; + } + + public void setNumfilial(Integer numfilial) { + this.numfilial = numfilial; + } + + public Integer getNumpdv() { + return numpdv; + } + + public void setNumpdv(Integer numpdv) { + this.numpdv = numpdv; + } + + 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 getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + + public List getEstacionList() { + return estacionList; + } + + public void setEstacionList(List estacionList) { + this.estacionList = estacionList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estacionsitefId != null ? estacionsitefId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EstacionSitef)) { + return false; + } + EstacionSitef other = (EstacionSitef) object; + if ((this.estacionsitefId == null && other.estacionsitefId != null) || (this.estacionsitefId != null && !this.estacionsitefId.equals(other.estacionsitefId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EstacionSitef[ estacionsitefId=" + estacionsitefId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index fb73ba900..9f951df0e 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -117,19 +117,19 @@ public class PuntoVenta implements Serializable { @JoinColumn(name = "PTOVTACOMISSAO_ID") - @OneToOne(cascade=CascadeType.ALL) + @ManyToOne(cascade=CascadeType.ALL) private PtovtaComissao comissaoId; @JoinColumn(name = "PTOVTADIVERSOS_ID") - @OneToOne(cascade=CascadeType.ALL) + @ManyToOne(cascade=CascadeType.ALL) private PtovtaDiversos diversosId; @JoinColumn(name = "PTOVTAAGENCIA_ID") - @OneToOne(cascade=CascadeType.ALL) + @ManyToOne(cascade=CascadeType.ALL) private PtovtaAgencia agenciaId; @JoinColumn(name = "PTOVTATITULAR_ID") - @OneToOne(cascade=CascadeType.ALL) + @ManyToOne(cascade=CascadeType.ALL) private PtovtaTitular titularId; diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java index 8b0b75ef3..d824601d0 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java @@ -86,6 +86,12 @@ public class EstacionServiceImpl implements EstacionService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.FALSE); + + if(entidad.getEstacionSitefId() != null){ + entidad.getEstacionSitefId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getEstacionSitefId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getEstacionSitefId().setActivo(Boolean.FALSE); + } estacionDAO.actualizacion(entidad); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index 71e94b48e..e1fa465ff 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.service.PtovtaEmpresaService; import com.rjconsultores.ventaboletos.service.PuntoVentaService; @@ -64,6 +65,38 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { forma.setFecmodif(Calendar.getInstance().getTime()); forma.setActivo(Boolean.FALSE); } + +// for (PtovtaEstoque forma : entidad.getPtovtaEstoqueList()) { +// forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// forma.setFecmodif(Calendar.getInstance().getTime()); +// forma.setActivo(Boolean.FALSE); +// } + + if(entidad.getAgenciaId() != null){ + + entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getAgenciaId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getAgenciaId().setActivo(Boolean.FALSE); + + } + + if(entidad.getComissaoId() != null){ + entidad.getComissaoId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getComissaoId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getComissaoId().setActivo(Boolean.FALSE); + } + + if(entidad.getDiversosId() != null){ + entidad.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getDiversosId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getDiversosId().setActivo(Boolean.FALSE); + } + + if(entidad.getTitularId() != null){ + entidad.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getTitularId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getTitularId().setActivo(Boolean.FALSE); + } entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime());