gleimar 2015-05-05 19:33:51 +00:00
parent 5aa2fc192a
commit 17ad799471
2 changed files with 15 additions and 2 deletions

View File

@ -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;

View File

@ -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", " ");
}
}