fixes bug #07034
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@51926 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
08c6e39d1f
commit
b71f49244d
|
@ -1,12 +1,16 @@
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.aidf.AidfVo;
|
||||||
|
|
||||||
public interface AidfDAO extends GenericDAO<Aidf, Long> {
|
public interface AidfDAO extends GenericDAO<Aidf, Long> {
|
||||||
|
|
||||||
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas);
|
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas);
|
||||||
|
|
||||||
|
public List<AidfVo> obtenerAidfFromSerieDocfiscal(String serie,String docfiscal, Connection conn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
@ -12,10 +17,13 @@ import org.springframework.stereotype.Repository;
|
||||||
import com.rjconsultores.ventaboletos.dao.AidfDAO;
|
import com.rjconsultores.ventaboletos.dao.AidfDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.aidf.AidfVo;
|
||||||
|
|
||||||
@Repository("aidfDAO")
|
@Repository("aidfDAO")
|
||||||
public class AidfHibernateDAO extends GenericHibernateDAO<Aidf, Long> implements AidfDAO{
|
public class AidfHibernateDAO extends GenericHibernateDAO<Aidf, Long> implements AidfDAO{
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(AidfHibernateDAO.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public AidfHibernateDAO(
|
public AidfHibernateDAO(
|
||||||
@Qualifier("sessionFactory") SessionFactory factory) {
|
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
@ -30,6 +38,61 @@ public class AidfHibernateDAO extends GenericHibernateDAO<Aidf, Long> implements
|
||||||
return (List<Aidf>)c.list();
|
return (List<Aidf>)c.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AidfVo> obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn){
|
||||||
|
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(" select x.AIDF_ID, ");
|
||||||
|
sb.append(" x.ESTADO_ID, ");
|
||||||
|
sb.append(" REGEXP_REPLACE( x.docfiscal ,'[^[:alnum:]'' '']', NULL) , ");
|
||||||
|
sb.append(" x.ACFISCAL, ");
|
||||||
|
sb.append(" x.SERIE, ");
|
||||||
|
sb.append(" x.FORMINICIAL, ");
|
||||||
|
sb.append(" x.FORMFINAL, ");
|
||||||
|
sb.append(" x.FECADQUISICION, ");
|
||||||
|
sb.append(" x.FECVENCIMIENTO, ");
|
||||||
|
sb.append(" x.INSCESTADUAL, ");
|
||||||
|
sb.append(" x.EMPRESA_ID, ");
|
||||||
|
sb.append(" x.AIDFESP_ID, ");
|
||||||
|
sb.append(" x.AIDFTIPO_ID, ");
|
||||||
|
sb.append(" x.ACTIVO, ");
|
||||||
|
sb.append(" x.FECMODIF, ");
|
||||||
|
sb.append(" x.USUARIO_ID, ");
|
||||||
|
sb.append(" x.SUBSERIE, ");
|
||||||
|
sb.append(" x.CNPJ, ");
|
||||||
|
sb.append(" x.TIPOVALIDAVENTA ");
|
||||||
|
sb.append(" from AIDF x where x.SERIE like '"+serie+"' ");
|
||||||
|
sb.append(" and REGEXP_REPLACE( x.docfiscal ,'[^[:alnum:]'' '']', NULL) like '"+docfiscal+"' ");
|
||||||
|
sb.append(" ");
|
||||||
|
|
||||||
|
|
||||||
|
List<AidfVo> ls = new ArrayList<AidfVo>();
|
||||||
|
|
||||||
|
try{
|
||||||
|
pstmt = conn.prepareStatement(sb.toString());
|
||||||
|
|
||||||
|
rs = pstmt.executeQuery();
|
||||||
|
while (rs.next()){
|
||||||
|
AidfVo a = new AidfVo();
|
||||||
|
a.setAidfId(rs.getLong(1));
|
||||||
|
a.setDocfiscal(rs.getString(3));
|
||||||
|
a.setSerie(rs.getString(5));
|
||||||
|
a.setForminicial(rs.getString(6));
|
||||||
|
a.setFormfinal(rs.getString(7));
|
||||||
|
ls.add(a);
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
log.error("", e);
|
||||||
|
} finally {
|
||||||
|
try { rs.close(); } catch (Exception ignore) { log.error("", ignore); }
|
||||||
|
try { pstmt.close(); } catch (Exception ignore) { log.error("", ignore); }
|
||||||
|
}
|
||||||
|
return ls;
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas) {
|
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas) {
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
import com.rjconsultores.ventaboletos.entidad.Aidf;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AidfEspecie;
|
import com.rjconsultores.ventaboletos.entidad.AidfEspecie;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AidfTipo;
|
import com.rjconsultores.ventaboletos.entidad.AidfTipo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.aidf.AidfVo;
|
||||||
|
|
||||||
public interface AidfService extends GenericService<Aidf, Long> {
|
public interface AidfService extends GenericService<Aidf, Long> {
|
||||||
|
|
||||||
public List<AidfEspecie> obtenerTodosAdifEspecie();
|
public List<AidfEspecie> obtenerTodosAdifEspecie();
|
||||||
public List<AidfTipo> obtenerTodosAdifTipo();
|
public List<AidfTipo> obtenerTodosAdifTipo();
|
||||||
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas);
|
public List<Aidf> buscaAidfsPorEmpresas(List<Empresa> empresas);
|
||||||
public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad);
|
public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn);
|
||||||
|
public List<AidfVo> obtenerAidfFromSerieDocfiscal(String serie,String docfiscal, Connection conn);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package com.rjconsultores.ventaboletos.service.impl;
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Criteria;
|
|
||||||
import org.hibernate.criterion.Restrictions;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -19,6 +18,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.service.AidfService;
|
import com.rjconsultores.ventaboletos.service.AidfService;
|
||||||
import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService;
|
import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.aidf.AidfVo;
|
||||||
|
|
||||||
@Service("aidfService")
|
@Service("aidfService")
|
||||||
public class AidfServiceImpl implements AidfService {
|
public class AidfServiceImpl implements AidfService {
|
||||||
|
@ -88,12 +88,16 @@ public class AidfServiceImpl implements AidfService {
|
||||||
return aidfs;
|
return aidfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad){
|
public List<AidfVo> obtenerAidfFromSerieDocfiscal(String serie,String docfiscal, Connection conn){
|
||||||
|
return aidfDAO.obtenerAidfFromSerieDocfiscal( serie, docfiscal, conn );
|
||||||
|
}
|
||||||
|
|
||||||
List<Aidf> list = obtenerTodos();
|
public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn){
|
||||||
|
|
||||||
for(Aidf e : list){
|
List<AidfVo> list = obtenerAidfFromSerieDocfiscal(entidad.getSerie() , entidad.getDocfiscal().replaceAll("[^a-zA-Z0-9]+","") , conn);
|
||||||
if(e.getDocfiscal().trim().equals(entidad.getDocfiscal().trim())){
|
|
||||||
|
for(AidfVo e : list){
|
||||||
|
if(e.getDocfiscal().trim().equals(entidad.getDocfiscal().replaceAll("[^a-zA-Z0-9]+","").trim())){
|
||||||
if(e.getSerie().trim().equals(entidad.getSerie().trim())){
|
if(e.getSerie().trim().equals(entidad.getSerie().trim())){
|
||||||
if( ( Long.parseLong(entidad.getForminicial()) >= Long.parseLong(e.getForminicial()) && Long.parseLong(entidad.getForminicial()) <= Long.parseLong(e.getFormfinal()) )
|
if( ( Long.parseLong(entidad.getForminicial()) >= Long.parseLong(e.getForminicial()) && Long.parseLong(entidad.getForminicial()) <= Long.parseLong(e.getFormfinal()) )
|
||||||
||
|
||
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.aidf;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AidfTipo;
|
||||||
|
|
||||||
|
public class AidfVo {
|
||||||
|
|
||||||
|
private Long aidfId;
|
||||||
|
private AidfTipo aidfTipo;
|
||||||
|
private Integer aidfEspecieId;
|
||||||
|
private Integer estadoId;
|
||||||
|
private String docfiscal;
|
||||||
|
private String acfiscal;
|
||||||
|
private String serie;
|
||||||
|
private String subserie;
|
||||||
|
private String forminicial;
|
||||||
|
private String formfinal;
|
||||||
|
private Date fecadquisicion;
|
||||||
|
private Date fecvencimiento;
|
||||||
|
private String inscestadual;
|
||||||
|
private Integer empresaId;
|
||||||
|
private Boolean activo;
|
||||||
|
private Date fecmodif;
|
||||||
|
private Integer usuarioId;
|
||||||
|
private String cnpj;
|
||||||
|
private String tipoValidaVenta;
|
||||||
|
public Long getAidfId() {
|
||||||
|
return aidfId;
|
||||||
|
}
|
||||||
|
public void setAidfId(Long aidfId) {
|
||||||
|
this.aidfId = aidfId;
|
||||||
|
}
|
||||||
|
public AidfTipo getAidfTipo() {
|
||||||
|
return aidfTipo;
|
||||||
|
}
|
||||||
|
public void setAidfTipo(AidfTipo aidfTipo) {
|
||||||
|
this.aidfTipo = aidfTipo;
|
||||||
|
}
|
||||||
|
public Integer getAidfEspecieId() {
|
||||||
|
return aidfEspecieId;
|
||||||
|
}
|
||||||
|
public void setAidfEspecieId(Integer aidfEspecieId) {
|
||||||
|
this.aidfEspecieId = aidfEspecieId;
|
||||||
|
}
|
||||||
|
public Integer getEstadoId() {
|
||||||
|
return estadoId;
|
||||||
|
}
|
||||||
|
public void setEstadoId(Integer estadoId) {
|
||||||
|
this.estadoId = estadoId;
|
||||||
|
}
|
||||||
|
public String getDocfiscal() {
|
||||||
|
return docfiscal;
|
||||||
|
}
|
||||||
|
public void setDocfiscal(String docfiscal) {
|
||||||
|
this.docfiscal = docfiscal;
|
||||||
|
}
|
||||||
|
public String getAcfiscal() {
|
||||||
|
return acfiscal;
|
||||||
|
}
|
||||||
|
public void setAcfiscal(String acfiscal) {
|
||||||
|
this.acfiscal = acfiscal;
|
||||||
|
}
|
||||||
|
public String getSerie() {
|
||||||
|
return serie;
|
||||||
|
}
|
||||||
|
public void setSerie(String serie) {
|
||||||
|
this.serie = serie;
|
||||||
|
}
|
||||||
|
public String getSubserie() {
|
||||||
|
return subserie;
|
||||||
|
}
|
||||||
|
public void setSubserie(String subserie) {
|
||||||
|
this.subserie = subserie;
|
||||||
|
}
|
||||||
|
public String getForminicial() {
|
||||||
|
return forminicial;
|
||||||
|
}
|
||||||
|
public void setForminicial(String forminicial) {
|
||||||
|
this.forminicial = forminicial;
|
||||||
|
}
|
||||||
|
public String getFormfinal() {
|
||||||
|
return formfinal;
|
||||||
|
}
|
||||||
|
public void setFormfinal(String formfinal) {
|
||||||
|
this.formfinal = formfinal;
|
||||||
|
}
|
||||||
|
public Date getFecadquisicion() {
|
||||||
|
return fecadquisicion;
|
||||||
|
}
|
||||||
|
public void setFecadquisicion(Date fecadquisicion) {
|
||||||
|
this.fecadquisicion = fecadquisicion;
|
||||||
|
}
|
||||||
|
public Date getFecvencimiento() {
|
||||||
|
return fecvencimiento;
|
||||||
|
}
|
||||||
|
public void setFecvencimiento(Date fecvencimiento) {
|
||||||
|
this.fecvencimiento = fecvencimiento;
|
||||||
|
}
|
||||||
|
public String getInscestadual() {
|
||||||
|
return inscestadual;
|
||||||
|
}
|
||||||
|
public void setInscestadual(String inscestadual) {
|
||||||
|
this.inscestadual = inscestadual;
|
||||||
|
}
|
||||||
|
public Integer getEmpresaId() {
|
||||||
|
return empresaId;
|
||||||
|
}
|
||||||
|
public void setEmpresaId(Integer empresaId) {
|
||||||
|
this.empresaId = empresaId;
|
||||||
|
}
|
||||||
|
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 getCnpj() {
|
||||||
|
return cnpj;
|
||||||
|
}
|
||||||
|
public void setCnpj(String cnpj) {
|
||||||
|
this.cnpj = cnpj;
|
||||||
|
}
|
||||||
|
public String getTipoValidaVenta() {
|
||||||
|
return tipoValidaVenta;
|
||||||
|
}
|
||||||
|
public void setTipoValidaVenta(String tipoValidaVenta) {
|
||||||
|
this.tipoValidaVenta = tipoValidaVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue