bug #7788
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@63249 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
98b6f5c76a
commit
70dda6981b
|
@ -196,9 +196,4 @@ public class Ciudad implements Serializable {
|
|||
public void setCodibge(Integer codibge) {
|
||||
this.codibge = codibge;
|
||||
}
|
||||
|
||||
public String getUF(){
|
||||
return estado != null ? estado.getCveestado() : "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -148,16 +148,4 @@ public class Colonia implements Serializable {
|
|||
public String toString() {
|
||||
return this.desccolonia;
|
||||
}
|
||||
|
||||
public String getBairro(){
|
||||
return desccolonia;
|
||||
}
|
||||
|
||||
public String getUF(){
|
||||
return ciudad != null ? ciudad.getUF() : "";
|
||||
}
|
||||
|
||||
public String getCidade(){
|
||||
return ciudad != null ? ciudad.getNombciudad() : "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ public class InscricaoEstadual {
|
|||
private String bairro;
|
||||
private Ciudad cidade;
|
||||
private String cnpj;
|
||||
private String equivalenciaAG;
|
||||
|
||||
public InscricaoEstadual() {
|
||||
// TODO Auto-generated constructor stub
|
||||
|
@ -190,15 +189,6 @@ public class InscricaoEstadual {
|
|||
this.cnpj = cnpj;
|
||||
}
|
||||
|
||||
@Column(name = "EQUIVALENCIAAG")
|
||||
public String getEquivalenciaAG() {
|
||||
return equivalenciaAG;
|
||||
}
|
||||
|
||||
public void setEquivalenciaAG(String equivalenciaAG) {
|
||||
this.equivalenciaAG = equivalenciaAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof EmpresaImposto)) {
|
||||
|
|
|
@ -168,12 +168,6 @@ public class PuntoVenta implements Serializable {
|
|||
|
||||
@Column(name = "INDINTEGRACION")
|
||||
private Integer indIntegracion;
|
||||
|
||||
@Column(name = "INDINTEGRADOAG")
|
||||
private Boolean indIntegradoAG;
|
||||
|
||||
@Column(name = "MOTIVONAOINTEGRADOAG")
|
||||
private String motivoNaoIntegradoAG;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId")
|
||||
@LazyCollection(LazyCollectionOption.FALSE)
|
||||
|
@ -885,22 +879,6 @@ public class PuntoVenta implements Serializable {
|
|||
this.equivalenciaId = equivalenciaId;
|
||||
}
|
||||
|
||||
public Boolean getIndIntegradoAG() {
|
||||
return indIntegradoAG;
|
||||
}
|
||||
|
||||
public void setIndIntegradoAG(Boolean indIntegradoAG) {
|
||||
this.indIntegradoAG = indIntegradoAG;
|
||||
}
|
||||
|
||||
public String getMotivoNaoIntegradoAG() {
|
||||
return motivoNaoIntegradoAG;
|
||||
}
|
||||
|
||||
public void setMotivoNaoIntegradoAG(String motivoNaoIntegradoAG) {
|
||||
this.motivoNaoIntegradoAG = motivoNaoIntegradoAG;
|
||||
}
|
||||
|
||||
public Date getDateFechamento() {
|
||||
return dateFechamento;
|
||||
}
|
||||
|
@ -916,32 +894,5 @@ public class PuntoVenta implements Serializable {
|
|||
public void setDateAbertura(Date dateAbertura) {
|
||||
this.dateAbertura = dateAbertura;
|
||||
}
|
||||
|
||||
public String getCep(){
|
||||
return codpostal != null ? codpostal.toString() : "";
|
||||
}
|
||||
|
||||
public String getLogradouro(){
|
||||
return direccioncalle;
|
||||
}
|
||||
|
||||
public String getBairro(){
|
||||
return colonia != null ? colonia.getBairro() : "";
|
||||
}
|
||||
|
||||
public String getNumero(){
|
||||
return direccionnumero;
|
||||
}
|
||||
|
||||
public String getComplemento(){
|
||||
return compl;
|
||||
}
|
||||
|
||||
public String getUF(){
|
||||
return colonia != null ? colonia.getUF() : "";
|
||||
}
|
||||
|
||||
public String getCidade(){
|
||||
return colonia != null ? colonia.getCidade() : "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,15 +4,10 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.rmi.RemoteException;
|
||||
import java.text.Normalizer;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.rpc.ServiceException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.brazilutils.br.cpfcnpj.CpfCnpj;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -20,13 +15,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.tempuri.IAG;
|
||||
import org.tempuri.IAGservice;
|
||||
import org.tempuri.IAGserviceLocator;
|
||||
|
||||
import AGIntf.TCliente;
|
||||
import AGIntf.TFornecedor;
|
||||
import AGIntf.TServicosCliente;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO;
|
||||
|
@ -131,9 +119,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
log.error(Atributos.MSG_ERRO_GENERICA, e);
|
||||
respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (respEx != null) {
|
||||
if (respEx instanceof ValidacionCampoException) {
|
||||
throw (ValidacionCampoException) respEx;
|
||||
|
@ -144,168 +130,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
}
|
||||
entidad = puntoVentaDAO.suscribir(entidad);
|
||||
|
||||
integrarClienteAG(entidad);
|
||||
integrarFornecedorAG(entidad);
|
||||
|
||||
return entidad;
|
||||
}
|
||||
|
||||
private void integrarFornecedorAG(PuntoVenta entidad) {
|
||||
if (ApplicationProperties.getInstance().integracionAGWS()) {
|
||||
try{
|
||||
IAGservice service = new IAGserviceLocator();
|
||||
IAG iag = service.getIAGPort(new URL("http://localhost:8089/cgi-bin/AGWS.exe/soap/IAG"));
|
||||
TFornecedor fornecedor = null;
|
||||
try{
|
||||
fornecedor = iag.getObjetoFornecedorPorCNPJCPF(entidad.getNumDoCPuntoVenta());
|
||||
} catch (RemoteException e) {
|
||||
log.error("", e.toString());
|
||||
}
|
||||
if (fornecedor != null){
|
||||
// retornar msg a informação de registro já cadastrado
|
||||
entidad.setIndIntegradoAG(false);
|
||||
entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado");
|
||||
} else {
|
||||
fornecedor = new TFornecedor();
|
||||
fornecedor.setNome(entidad.getRazonSocial());
|
||||
fornecedor.setNomeFantasia(entidad.getNombpuntoventa());
|
||||
fornecedor.setCNPJCPF(entidad.getNumDoCPuntoVenta());
|
||||
fornecedor.setGrupo("");
|
||||
fornecedor.setReceita("");
|
||||
fornecedor.setCodigo("");
|
||||
fornecedor.setCEP(entidad.getCep());
|
||||
fornecedor.setLogradouro(""+entidad.getLogradouro());
|
||||
fornecedor.setBairro(entidad.getBairro());
|
||||
fornecedor.setNumero(""+entidad.getNumero());
|
||||
fornecedor.setComplemento(""+entidad.getComplemento());
|
||||
fornecedor.setUF(entidad.getUF());
|
||||
fornecedor.setCidade(entidad.getCidade());
|
||||
fornecedor.setDDD("");
|
||||
fornecedor.setFone("");
|
||||
fornecedor.setFax("");
|
||||
fornecedor.setEmail("");
|
||||
fornecedor.setContato("");
|
||||
fornecedor.setSite("");
|
||||
fornecedor.setRG("");
|
||||
fornecedor.setIE("");
|
||||
fornecedor.setIM("");
|
||||
fornecedor.setReferencia("");
|
||||
fornecedor.setFinalidadeTED("");
|
||||
fornecedor.setFinalidadeDOC("");
|
||||
fornecedor.setCelular("");
|
||||
fornecedor.setLeiaute("");
|
||||
fornecedor.setBanco("");
|
||||
fornecedor.setBancoNumero("");
|
||||
fornecedor.setAgencia("");
|
||||
fornecedor.setCC("");
|
||||
fornecedor.setDVAg("");
|
||||
fornecedor.setDVCC("");
|
||||
fornecedor.setIDWS(entidad.getPuntoventaId().toString());
|
||||
try{
|
||||
String retornoAG = iag.incluiFornecedor(fornecedor);
|
||||
System.out.println(retornoAG);
|
||||
} catch (RemoteException e) {
|
||||
entidad.setIndIntegradoAG(false);
|
||||
entidad.setMotivoNaoIntegradoAG(e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (ServiceException se){
|
||||
log.error("", se.toString());
|
||||
} catch (MalformedURLException me){
|
||||
log.error("", me.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void integrarClienteAG(PuntoVenta entidad) {
|
||||
if (ApplicationProperties.getInstance().integracionAGWS()) {
|
||||
try{
|
||||
IAGservice service = new IAGserviceLocator();
|
||||
IAG iag = service.getIAGPort(new URL("http://localhost:8089/cgi-bin/AGWS.exe/soap/IAG"));
|
||||
TCliente cli = null;
|
||||
try{
|
||||
cli = iag.getObjetoClienteCPFCNPJ(entidad.getNumDoCPuntoVenta());
|
||||
} catch (RemoteException e) {
|
||||
log.error("", e.toString());
|
||||
}
|
||||
if (cli != null){
|
||||
// retornar msg a informação de registro já cadastrado
|
||||
entidad.setIndIntegradoAG(false);
|
||||
entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado");
|
||||
} else {
|
||||
cli = new TCliente();
|
||||
cli.setCodigo("");
|
||||
cli.setNome(entidad.getRazonSocial());
|
||||
cli.setNomeFantasia(entidad.getNombpuntoventa());
|
||||
cli.setCnpjcpf(entidad.getNumDoCPuntoVenta());
|
||||
cli.setGrupo("");
|
||||
cli.setAgenteCobrador("");
|
||||
cli.setVencimento(0);
|
||||
cli.setContaContabil("");
|
||||
cli.setCep(entidad.getCep());
|
||||
cli.setLogradouro(""+entidad.getLogradouro());
|
||||
cli.setBairro(entidad.getBairro());
|
||||
cli.setNumero(""+entidad.getNumero());
|
||||
cli.setComplemento(""+entidad.getComplemento());
|
||||
cli.setUf(entidad.getUF());
|
||||
cli.setCidade(entidad.getCidade());
|
||||
cli.setDdd("");
|
||||
cli.setFone("");
|
||||
cli.setDddFax("");
|
||||
cli.setFax("");
|
||||
cli.setIdentificador("");
|
||||
cli.setDddCelular("");
|
||||
cli.setCelular("");
|
||||
cli.setEmail("");
|
||||
cli.setContato("");
|
||||
cli.setSite("");
|
||||
cli.setRg("");
|
||||
cli.setIe("");
|
||||
cli.setReceita("");
|
||||
cli.setRepresentante("");
|
||||
cli.setIM("");
|
||||
cli.setCampoExtra1("");
|
||||
cli.setCampoExtra10("");
|
||||
cli.setCampoExtra2("");
|
||||
cli.setCampoExtra3("");
|
||||
cli.setCampoExtra4("");
|
||||
cli.setCampoExtra5("");
|
||||
cli.setCampoExtra6("");
|
||||
cli.setCampoExtra7("");
|
||||
cli.setCampoExtra8("");
|
||||
cli.setCampoExtra9("");
|
||||
cli.setServicosCliente(new TServicosCliente());
|
||||
cli.setIDWS(entidad.getPuntoventaId().toString());
|
||||
cli.getServicosCliente().setServico("");
|
||||
cli.getServicosCliente().setEstabelecimento("");
|
||||
cli.getServicosCliente().setModalidade("");
|
||||
cli.getServicosCliente().setIndexador("");
|
||||
cli.getServicosCliente().setAnoMesPrimeiraCobranca("");
|
||||
cli.getServicosCliente().setAquisicao(Calendar.getInstance());
|
||||
cli.getServicosCliente().setAnoMesReajuste("");
|
||||
cli.getServicosCliente().setObservacao("");
|
||||
cli.getServicosCliente().setDescricaoNota("");
|
||||
cli.getServicosCliente().setComplementoDescricaoNota("");
|
||||
cli.getServicosCliente().setContrato("");
|
||||
cli.getServicosCliente().setDtCancelamento(Calendar.getInstance());
|
||||
cli.getServicosCliente().setObsCancelamento("");
|
||||
cli.getServicosCliente().setCRS_Codigo("");
|
||||
try{
|
||||
String retornoAG = iag.incluiCliente(cli);
|
||||
System.out.println(retornoAG);
|
||||
} catch (RemoteException e) {
|
||||
entidad.setIndIntegradoAG(false);
|
||||
entidad.setMotivoNaoIntegradoAG(e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (ServiceException se){
|
||||
log.error("", se.toString());
|
||||
} catch (MalformedURLException me){
|
||||
log.error("", me.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class })
|
||||
public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException {
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
@ -357,9 +184,6 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
|||
|
||||
entidad = puntoVentaDAO.actualizacion(entidad);
|
||||
|
||||
integrarClienteAG(entidad);
|
||||
integrarFornecedorAG(entidad);
|
||||
|
||||
if (respEx != null) {
|
||||
if (respEx instanceof IntegracionException) {
|
||||
throw (IntegracionException) respEx;
|
||||
|
|
|
@ -139,16 +139,6 @@ public class ApplicationProperties {
|
|||
return property.equals("1");
|
||||
}
|
||||
|
||||
public boolean integracionAG() {
|
||||
String property = p.getProperty("integracion.AG", "0");
|
||||
return property.equals("1");
|
||||
}
|
||||
|
||||
public boolean integracionAGWS() {
|
||||
String property = p.getProperty("integracion.agws", "0");
|
||||
return property.equals("1");
|
||||
}
|
||||
|
||||
public boolean integracionRioCard() {
|
||||
String property = p.getProperty("integracion.riocard", "0");
|
||||
return property.equals("1");
|
||||
|
|
Loading…
Reference in New Issue