diff --git a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java index 9f2e253bf..9819013e0 100644 --- a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java +++ b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java @@ -6,8 +6,6 @@ package com.rjconsultores.ventaboletos.service; import java.util.List; -import org.hibernate.Session; - import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index f3a032efa..9d83e16d6 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.service.impl; +import java.text.Normalizer; import java.util.Calendar; import java.util.List; @@ -329,11 +330,18 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { String cnpjEmpresaProtheus = Atributos.CNPJ_EMPRESA_PROTHEUS; String nome = puntoVenta.getNombpuntoventa(); + nome = removerAcentosCaracteresEspeciais(nome); + String cgc = puntoVenta.getNumDoCPuntoVenta(); String endereco = puntoVenta.getDireccioncalle() + "," + ((puntoVenta.getDireccionnumero() == null) ? "" : puntoVenta.getDireccionnumero()); + endereco = removerAcentosCaracteresEspeciais(endereco); + String complemen = puntoVenta.getCompl() == null ? "" : puntoVenta.getCompl(); + complemen = removerAcentosCaracteresEspeciais(complemen); + String bairro = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getDesccolonia(); + bairro = removerAcentosCaracteresEspeciais(bairro); String codmun = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getCodmunicipio().toString(); codmun = (codmun == null) ? "" : StringUtils.leftPad(codmun, 5, '0'); @@ -457,5 +465,12 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { vlr = somenteNumeros(vlr); return vlr.length() > 11; } + private String removerAcentosCaracteresEspeciais(String s){ + if (StringUtils.isBlank(s)){ + return s; + } + s = StringUtils.trim(s); + return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").replaceAll("\\W", " "); + } }