Skip to content

Commit

Permalink
Corrigindo schema consultar-documento-transporte
Browse files Browse the repository at this point in the history
O json.schema provido pela documentação da API do portal único estava incorreto.
Foi corrigido o schema para refletir o formato correto do JSON retornado como resultado dos serviços do Portal Único Siscomex, conforme identificado durante o processo de integração.
  • Loading branch information
imerljak authored and Israel Merljak committed Jun 26, 2018
1 parent ad0eb68 commit 5376ada
Show file tree
Hide file tree
Showing 11 changed files with 509 additions and 585 deletions.
13 changes: 3 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>samuelfac</groupId>
<groupId>imerljak</groupId>
<artifactId>portalunico.siscomex.gov.br</artifactId>
<version>04-06-2018.2</version>
<version>1.0.0</version>
<name>PortalUnicoSiscomex</name>
<description>Classes da API do Portal Único de Comércio Exterior, a nova forma de interação entre as empresas privadas e os diversos órgãos públicos intervenientes no comércio exterior.</description>
<url>https://val.portalunico.siscomex.gov.br/docs/api/</url>
<organization>
<name>Samuel Facchinello</name>
<url>https://about.me/samuelfac</url>
<name>Israel Merljak</name>
</organization>
<scm>
<developerConnection>Samuel Facchinello</developerConnection>
</scm>
<issueManagement>
<system>GitHub Issues</system>
</issueManagement>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
Expand Down
270 changes: 140 additions & 130 deletions schemas/cct/consultar-documento-transporte.schema.json
Original file line number Diff line number Diff line change
@@ -1,132 +1,142 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"$id": "http://www.pucomex.serpro.gov.br/cct/consulta-documento-transporte.schema.json",
"properties": {
"numeroDocumento": {
"type": "string"
},
"tipoDocumento": {
"type": "string"
},
"viaTransporte": {
"type": "string"
},
"situacaoDocumento": {
"type": "string"
},
"cargas": {
"type": "array",
"items": {
"type": "object",
"properties": {
"numeroDue": {
"type": "string"
},
"numeroRuc": {
"type": "string"
},
"conteiner": {
"type": "object",
"properties": {
"numeroConteiner": {
"type": "string"
},
"tara": {
"type": "number"
},
"lacres": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
}
}
}
},
"veiculoRodoviario": {
"type": "object",
"properties": {
"veiculo": {
"type": "object",
"properties": {
"nomeCondutor": {
"type": "string"
},
"cpfCondutor": {
"type": "string"
},
"documentoCondutor": {
"type": "string"
},
"placa": {
"type": "string"
},
"tara": {
"type": "number"
},
"lacres": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
},
"reboques": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"placa": {
"type": "string"
},
"tara": {
"type": "number"
},
"lacres": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
}
}
}
},
"prefixoTrem": {
"type": "string"
},
"quantidadeVagoes": {
"type": "integer"
},
"identificacaoVeiculo": {
"type": "string"
},
"dataEmissaoDocumentoTransporte": {
"type": "string"
},
"mensagens": {
"type": "array",
"items": {
"type": "object",
"properties": {
"codigo": {
"type": "string"
},
"mensagem": {
"type": "string"
}
}
}
}
}
"definitions": {},
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"$id": "http://www.pucomex.serpro.gov.br/cct/consulta-documento-transporte.schema.json",
"properties": {
"documentosTransporte": {
"$id": "/properties/documentosTransporte",
"type": "array",
"items": {
"$id": "/properties/documentosTransporte/items",
"type": "object",
"properties": {
"numeroDocumento": {
"type": "string"
},
"tipoDocumento": {
"type": "string"
},
"viaTransporte": {
"type": "string"
},
"situacaoDocumento": {
"type": "string"
},
"cargas": {
"type": "array",
"items": {
"type": "object",
"properties": {
"numeroDue": {
"type": "string"
},
"numeroRuc": {
"type": "string"
},
"conteiner": {
"type": "object",
"properties": {
"numeroConteiner": {
"type": "string"
},
"tara": {
"type": "number"
},
"lacres": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
}
}
}
},
"veiculoRodoviario": {
"type": "object",
"properties": {
"veiculo": {
"type": "object",
"properties": {
"nomeCondutor": {
"type": "string"
},
"cpfCondutor": {
"type": "string"
},
"documentoCondutor": {
"type": "string"
},
"placa": {
"type": "string"
},
"tara": {
"type": "number"
},
"lacres": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
},
"reboques": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"placa": {
"type": "string"
},
"tara": {
"type": "number"
},
"lacres": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
}
}
}
},
"prefixoTrem": {
"type": "string"
},
"quantidadeVagoes": {
"type": "integer"
},
"identificacaoVeiculo": {
"type": "string"
},
"dataEmissaoDocumentoTransporte": {
"type": "string"
}
}
}
},
"mensagens": {
"type": "array",
"items": {
"type": "object",
"properties": {
"codigo": {
"type": "string"
},
"mensagem": {
"type": "string"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,47 +42,30 @@ public void setConteiner(Conteiner conteiner) {

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(Carga.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("numeroDue");
sb.append('=');
sb.append(((this.numeroDue == null)?"<null>":this.numeroDue));
sb.append(',');
sb.append("numeroRuc");
sb.append('=');
sb.append(((this.numeroRuc == null)?"<null>":this.numeroRuc));
sb.append(',');
sb.append("conteiner");
sb.append('=');
sb.append(((this.conteiner == null)?"<null>":this.conteiner));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
} else {
sb.append(']');
}
return sb.toString();
return "Carga{" +
"numeroDue='" + numeroDue + '\'' +
", numeroRuc='" + numeroRuc + '\'' +
", conteiner=" + conteiner +
'}';
}

@Override
public int hashCode() {
int result = 1;
result = ((result* 31)+((this.numeroRuc == null)? 0 :this.numeroRuc.hashCode()));
result = ((result* 31)+((this.numeroDue == null)? 0 :this.numeroDue.hashCode()));
result = ((result* 31)+((this.conteiner == null)? 0 :this.conteiner.hashCode()));
return result;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

Carga carga = (Carga) o;

if (numeroDue != null ? !numeroDue.equals(carga.numeroDue) : carga.numeroDue != null) return false;
if (numeroRuc != null ? !numeroRuc.equals(carga.numeroRuc) : carga.numeroRuc != null) return false;
return conteiner != null ? conteiner.equals(carga.conteiner) : carga.conteiner == null;
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof Carga) == false) {
return false;
}
Carga rhs = ((Carga) other);
return ((((this.numeroRuc == rhs.numeroRuc)||((this.numeroRuc!= null)&&this.numeroRuc.equals(rhs.numeroRuc)))&&((this.numeroDue == rhs.numeroDue)||((this.numeroDue!= null)&&this.numeroDue.equals(rhs.numeroDue))))&&((this.conteiner == rhs.conteiner)||((this.conteiner!= null)&&this.conteiner.equals(rhs.conteiner))));
public int hashCode() {
int result = numeroDue != null ? numeroDue.hashCode() : 0;
result = 31 * result + (numeroRuc != null ? numeroRuc.hashCode() : 0);
result = 31 * result + (conteiner != null ? conteiner.hashCode() : 0);
return result;
}

}
Loading

0 comments on commit 5376ada

Please sign in to comment.