diff --git a/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCCFDAO.java b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCCFDAO.java new file mode 100644 index 000000000..00718397c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCCFDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCFR2; + +public interface MonitoramentoCCFDAO extends GenericDAO { + public List buscaQuebraCCF(String numserie20, Date data); + public List buscaRegistrosR2(Date data); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCRZDAO.java b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCRZDAO.java new file mode 100644 index 000000000..686af29c0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCRZDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; + +public interface MonitoramentoCRZDAO extends GenericDAO { + public List buscaQuebraCRZ(Date data); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCCFHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCCFHibernateDAO.java new file mode 100644 index 000000000..a1531b23d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCCFHibernateDAO.java @@ -0,0 +1,133 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.ResultSet; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.hibernate.SessionFactory; +import org.jfree.util.Log; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MonitoramentoCCFDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCFR2; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +@Repository("monitoramentoCCFDAO") +public class MonitoramentoCCFHibernateDAO extends GenericHibernateDAO +implements MonitoramentoCCFDAO { + + @Autowired + public MonitoramentoCCFHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + private String getSQL(){ + StringBuilder sql = new StringBuilder(); + + sql.append(" select "); + sql.append(" fi.empresa_id as empresa, "); + sql.append(" r4.numserie20, "); + sql.append(" fi.fiscalimpressora_id, "); + sql.append(" fi.estadolocal_id as estado, "); + sql.append(" to_date(r4.datamov, 'YYYYMMDD') as datamov, "); + sql.append(" fi.puntoventa_id, "); + sql.append(" r4.usuario_id, "); + sql.append(" r4.coo "); + sql.append("from "); + sql.append(" fiscal_r4 r4 "); + sql.append(" left join fiscal_impressora fi on fi.NUMSERIE20 = r4.NUMSERIE20 "); + sql.append("where "); + sql.append(" to_date(r4.datamov, 'YYYYMMDD') = to_date(:dataIni, 'YYYY-MM-DD') "); + sql.append(" and fi.numserie20 = :numserie20 "); + sql.append(" order by r4.coo "); + + return sql.toString(); + } + + private String getSQLR2(){ + StringBuilder sql = new StringBuilder(); + + sql.append(" select "); + sql.append(" coalesce(to_number((select r22.ccf from fiscal_r2 r22 where r22.numserie20 = r2.numserie20 and to_number(r22.crz, '999999999') = to_number(r2.crz, '999999999') -1), '999999999'), to_number(r2.ccf, '999999999')) as cooinicial, "); + sql.append(" r2.ccf as coofinal, "); + sql.append(" fi.numserie20, "); + sql.append(" fie.estado_id, "); + sql.append(" fi.empresa_id, "); + sql.append(" fi.puntoventa_id, "); + sql.append(" fi.fiscalimpressora_id "); + sql.append("from fiscal_r2 r2 "); + sql.append(" left join fiscal_impressora fi on fi.NUMSERIE20 = r2.NUMSERIE20 "); + sql.append(" left join fiscal_impressora_estado fie on fie.fiscalimpressora_id = fi.fiscalimpressora_id "); + sql.append("where "); + sql.append(" r2.datamov = :datamov "); + sql.append("order by datamov; "); + + return sql.toString(); + } + + public List buscaRegistrosR2(Date data){ + List result = new ArrayList(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + try{ + NamedParameterStatement stmt = new NamedParameterStatement(getSession().connection(), getSQLR2()); + stmt.setString("datamov", sdf.format(data.getTime())); + + ResultSet rset = stmt.executeQuery(); + + while (rset.next()) { + MonitoramentoCCFR2 m = new MonitoramentoCCFR2(); + m.cooinicio = rset.getInt(1); + m.coofim = rset.getInt(2); + m.numserie20 = rset.getString(3); + m.estadoId = rset.getInt(4); + m.empresaId = rset.getInt(5); + m.puntoventaId = rset.getInt(6); + m.fiscalImpressoraId = rset.getInt(7); + result.add(m); + } + } catch (Exception e){ + Log.error("", e); + } + return result; + } + + public List buscaQuebraCCF(String numserie20, Date data){ + List result = new ArrayList(); + try{ + NamedParameterStatement stmt = new NamedParameterStatement(getSession().connection(), getSQL()); + stmt.setDate("dataIni", new java.sql.Date(data.getTime())); + stmt.setString("numserie20", numserie20); + + ResultSet rset = stmt.executeQuery(); + + while (rset.next()) { + MonitoramentoCCF m = new MonitoramentoCCF(); + m.setDataMonitoramento(new Date()); + m.setDataOcorrencia(rset.getDate("datamov")); + m.setDiasAlertaAberto(new Date()); + m.setImpressora(new FiscalImpressora(rset.getInt("fiscalimpressora_id"))); + m.setEmpresa(new Empresa(rset.getInt("empresa"))); + m.setEstadoInstalacao(new Estado(rset.getInt("estado"))); + m.setPuntoventa(new PuntoVenta(rset.getInt("puntoventa"))); + m.setSequenciaCCFQuebrada(rset.getInt("coo")); + m.setUsuario(new Usuario(rset.getInt("usuario_id"))); + + result.add(m); + } + } catch (Exception e){ + Log.error("", e); + } + return result; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCRZHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCRZHibernateDAO.java new file mode 100644 index 000000000..bcb287deb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCRZHibernateDAO.java @@ -0,0 +1,86 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.hibernate.SessionFactory; +import org.jfree.util.Log; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MonitoramentoCRZDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +@Repository("monitoramentoCRZDAO") +public class MonitoramentoCRZHibernateDAO extends GenericHibernateDAO +implements MonitoramentoCRZDAO { + + @Autowired + public MonitoramentoCRZHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + private String getSQL(){ + StringBuilder sql = new StringBuilder(); + + sql.append(" select "); + sql.append(" r2.numserie20, "); + sql.append(" c.serieimpfiscal, "); + sql.append(" fi.numserie, "); + sql.append(" fi.fiscalimpressora_id, "); + sql.append(" to_date(r2.datamov, 'YYYYMMDD') as datamov, "); + sql.append(" r2.COOINICIAL, "); + sql.append(" r2.COOFINAL, "); + sql.append(" fi.estadolocal_id as estado, "); + sql.append(" fi.empresa_id as empresa, "); + sql.append(" r2.puntoventa_id as puntoventa, "); + sql.append(" r2.CRZ as CRZ, "); + sql.append(" r2.usuario_id as usuario_id "); + sql.append("from "); + sql.append(" fiscal_r2 r2 "); + sql.append(" left join fiscal_impressora fi on fi.NUMSERIE20 = r2.NUMSERIE20 "); + sql.append(" left join caja c on c.serieimpfiscal = fi.numserie "); + sql.append("where "); + sql.append(" c.serieimpfiscal is null "); + sql.append(" and to_date(r2.datamov, 'YYYYMMDD') = to_date(:dataIni, 'YYYY-MM-DD') "); + + return sql.toString(); + } + + public List buscaQuebraCRZ(Date data){ + List result = new ArrayList(); + try{ + NamedParameterStatement stmt = new NamedParameterStatement(getSession().connection(), getSQL()); + stmt.setDate("data", new java.sql.Date(data.getTime())); + + ResultSet rset = stmt.executeQuery(); + + while (rset.next()) { + MonitoramentoCRZ m = new MonitoramentoCRZ(); + m.setDataMonitoramento(new Date()); + m.setDataReducaoZFaltante(rset.getDate("datamov")); + m.setDiasAlertaAberto(new Date()); + m.setEmpresa(new Empresa(rset.getInt("empresa"))); + m.setEstadoInstalacao(new Estado(rset.getInt("estado"))); + m.setPuntoventa(new PuntoVenta(rset.getInt("puntoventa"))); + m.setSequenciaCRZQuebrada(rset.getInt("CRZ")); + m.setUltimoUsuarioECF(new Usuario(rset.getInt("usuario_id"))); + m.setImpressora(new FiscalImpressora(rset.getInt("fiscalimpressora_id"))); + result.add(m); + } + } catch (Exception e){ + Log.error("", e); + } + return result; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCF.java b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCF.java new file mode 100644 index 000000000..bed7519d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCF.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +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.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "MONITORAMENTO_CCF_SEQ", sequenceName = "MONITORAMENTO_CCF_SEQ", allocationSize = 1) +@Table(name = "MONITORAMENTO_CCF") +public class MonitoramentoCCF { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MONITORAMENTO_CCF_SEQ") + @Column(name = "MONITORAMENTOCCF_ID") + private Integer monitoramentoCcfId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "UF_INSTALACAO", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estadoInstalacao; + @JoinColumn(name = "FISCALIMPRESSORA_ID", referencedColumnName = "FISCALIMPRESSORA_ID") + @ManyToOne + private FiscalImpressora impressora; + @Column(name = "DATA_OCORRENCIA") + private Date dataOcorrencia; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventa; + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuario; + @Column(name = "SEQUENCIA_CCF_QUEBRADA") + private Integer sequenciaCCFQuebrada; + @Column(name = "DATA_MONITORAMENTO") + private Date dataMonitoramento; + @Column(name = "DIAS_ALERTA_ABERTO") + private Date diasAlertaAberto; + @Column(name = "REPROCESSADO") + private Boolean reprocessado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + private Date fecmodif; + @JoinColumn(name = "USUARIOMODIF_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuarioModif; + + + public Integer getMonitoramentoCcfId() { + return monitoramentoCcfId; + } + public void setMonitoramentoCcfId(Integer monitoramentoCcfId) { + this.monitoramentoCcfId = monitoramentoCcfId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Estado getEstadoInstalacao() { + return estadoInstalacao; + } + public void setEstadoInstalacao(Estado estadoInstalacao) { + this.estadoInstalacao = estadoInstalacao; + } + public Date getDataOcorrencia() { + return dataOcorrencia; + } + public void setDataOcorrencia(Date dataOcorrencia) { + this.dataOcorrencia = dataOcorrencia; + } + public PuntoVenta getPuntoventa() { + return puntoventa; + } + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + public Usuario getUsuario() { + return usuario; + } + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + public Integer getSequenciaCCFQuebrada() { + return sequenciaCCFQuebrada; + } + public void setSequenciaCCFQuebrada(Integer sequenciaCCFQuebrada) { + this.sequenciaCCFQuebrada = sequenciaCCFQuebrada; + } + public Date getDataMonitoramento() { + return dataMonitoramento; + } + public void setDataMonitoramento(Date dataMonitoramento) { + this.dataMonitoramento = dataMonitoramento; + } + public Date getDiasAlertaAberto() { + return diasAlertaAberto; + } + public void setDiasAlertaAberto(Date diasAlertaAberto) { + this.diasAlertaAberto = diasAlertaAberto; + } + public Boolean getReprocessado() { + return reprocessado; + } + public void setReprocessado(Boolean reprocessado) { + this.reprocessado = reprocessado; + } + 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 Usuario getUsuarioModif() { + return usuarioModif; + } + public void setUsuarioModif(Usuario usuarioModif) { + this.usuarioModif = usuarioModif; + } + public FiscalImpressora getImpressora() { + return impressora; + } + public void setImpressora(FiscalImpressora impressora) { + this.impressora = impressora; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCFR2.java b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCFR2.java new file mode 100644 index 000000000..7c156b89f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCFR2.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.entidad; + +public class MonitoramentoCCFR2 { + public Integer cooinicio; + public Integer coofim; + public String numserie20; + public Integer estadoId; + public Integer empresaId; + public Integer puntoventaId; + public Integer fiscalImpressoraId; +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCRZ.java b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCRZ.java new file mode 100644 index 000000000..d07359776 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCRZ.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +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.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "MONITORAMENTO_CRZ_SEQ", sequenceName = "MONITORAMENTO_CRZ_SEQ", allocationSize = 1) +@Table(name = "MONITORAMENTO_CRZ") +public class MonitoramentoCRZ { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MONITORAMENTO_CRZ_SEQ") + @Column(name = "MONITORAMENTOCRZ_ID") + private Integer monitoramentoCrzId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "UF_INSTALACAO", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estadoInstalacao; + @JoinColumn(name = "FISCALIMPRESSORA_ID", referencedColumnName = "FISCALIMPRESSORA_ID") + @ManyToOne + private FiscalImpressora impressora; + @Column(name = "DATA_REDUCAOZ_FALTANTE") + private Date dataReducaoZFaltante; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventa; + @JoinColumn(name = "ULTIMO_USUARIO_ECF_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario ultimoUsuarioECF; + @Column(name = "SEQUENCIA_CRZ_QUEBRADA") + private Integer sequenciaCRZQuebrada; + @Column(name = "DATA_MONITORAMENTO") + private Date dataMonitoramento; + @Column(name = "DIAS_ALERTA_ABERTO") + private Date diasAlertaAberto; + @Column(name = "REPROCESSADO") + private Boolean reprocessado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + private Date fecmodif; + @JoinColumn(name = "USUARIOMODIF_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuarioModif; + + public Integer getMonitoramentoCrzId() { + return monitoramentoCrzId; + } + public void setMonitoramentoCrzId(Integer monitoramentoCrzId) { + this.monitoramentoCrzId = monitoramentoCrzId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Estado getEstadoInstalacao() { + return estadoInstalacao; + } + public void setEstadoInstalacao(Estado estadoInstalacao) { + this.estadoInstalacao = estadoInstalacao; + } + public Date getDataReducaoZFaltante() { + return dataReducaoZFaltante; + } + public void setDataReducaoZFaltante(Date dataReducaoZFaltante) { + this.dataReducaoZFaltante = dataReducaoZFaltante; + } + public PuntoVenta getPuntoventa() { + return puntoventa; + } + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + public Usuario getUltimoUsuarioECF() { + return ultimoUsuarioECF; + } + public void setUltimoUsuarioECF(Usuario ultimoUsuarioECF) { + this.ultimoUsuarioECF = ultimoUsuarioECF; + } + public Integer getSequenciaCRZQuebrada() { + return sequenciaCRZQuebrada; + } + public void setSequenciaCRZQuebrada(Integer sequenciaCRZQuebrada) { + this.sequenciaCRZQuebrada = sequenciaCRZQuebrada; + } + public Date getDataMonitoramento() { + return dataMonitoramento; + } + public void setDataMonitoramento(Date dataMonitoramento) { + this.dataMonitoramento = dataMonitoramento; + } + public Date getDiasAlertaAberto() { + return diasAlertaAberto; + } + public void setDiasAlertaAberto(Date diasAlertaAberto) { + this.diasAlertaAberto = diasAlertaAberto; + } + public Boolean getReprocessado() { + return reprocessado; + } + public void setReprocessado(Boolean reprocessado) { + this.reprocessado = reprocessado; + } + 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 Usuario getUsuarioModif() { + return usuarioModif; + } + public void setUsuarioModif(Usuario usuarioModif) { + this.usuarioModif = usuarioModif; + } + public FiscalImpressora getImpressora() { + return impressora; + } + public void setImpressora(FiscalImpressora impressora) { + this.impressora = impressora; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/MonitoramentoCCFService.java b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCCFService.java new file mode 100644 index 000000000..d8a752823 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCCFService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCFR2; + +public interface MonitoramentoCCFService extends GenericService { + public List buscaQuebraCCF(String numserie20, Date data); + public List buscaRegistrosR2(Date data); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MonitoramentoCRZService.java b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCRZService.java new file mode 100644 index 000000000..78a450772 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCRZService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; + +public interface MonitoramentoCRZService extends GenericService { + public List buscaQuebraCRZ(Date data); +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCCFServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCCFServiceImpl.java new file mode 100644 index 000000000..b0f996120 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCCFServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +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.MonitoramentoCCFDAO; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCFR2; +import com.rjconsultores.ventaboletos.service.MonitoramentoCCFService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("monitoramentoCCFService") +public class MonitoramentoCCFServiceImpl implements MonitoramentoCCFService{ + @Autowired + private MonitoramentoCCFDAO monitoramentoCCFDAO; + + public List obtenerTodos() { + return monitoramentoCCFDAO.obtenerTodos(); + } + + public MonitoramentoCCF obtenerID(Integer id) { + return monitoramentoCCFDAO.obtenerID(id); + } + + @Transactional + public MonitoramentoCCF suscribir(MonitoramentoCCF entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monitoramentoCCFDAO.suscribir(entidad); + } + + @Transactional + public MonitoramentoCCF actualizacion(MonitoramentoCCF entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monitoramentoCCFDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MonitoramentoCCF entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + monitoramentoCCFDAO.actualizacion(entidad); + } + + @Override + public List buscaQuebraCCF(String numserie20, Date data) { + return monitoramentoCCFDAO.buscaQuebraCCF(numserie20, data); + } + + @Override + public List buscaRegistrosR2(Date data){ + return monitoramentoCCFDAO.buscaRegistrosR2(data); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCRZServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCRZServiceImpl.java new file mode 100644 index 000000000..6d0ade2d4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCRZServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +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.MonitoramentoCRZDAO; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; +import com.rjconsultores.ventaboletos.service.MonitoramentoCRZService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("monitoramentoCRZService") +public class MonitoramentoCRZServiceImpl implements MonitoramentoCRZService{ + @Autowired + private MonitoramentoCRZDAO monitoramentoCRZDAO; + + public List obtenerTodos() { + return monitoramentoCRZDAO.obtenerTodos(); + } + + public MonitoramentoCRZ obtenerID(Integer id) { + return monitoramentoCRZDAO.obtenerID(id); + } + + @Transactional + public MonitoramentoCRZ suscribir(MonitoramentoCRZ entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monitoramentoCRZDAO.suscribir(entidad); + } + + @Transactional + public MonitoramentoCRZ actualizacion(MonitoramentoCRZ entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monitoramentoCRZDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MonitoramentoCRZ entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + monitoramentoCRZDAO.actualizacion(entidad); + } + + @Override + public List buscaQuebraCRZ(Date data){ + return monitoramentoCRZDAO.buscaQuebraCRZ(data); + } +}