diff --git a/pom.xml b/pom.xml
index 2b9bb5e6..70a6228d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,11 +1,11 @@
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
- 2.6.3
+ 2.6.4-SNAPSHOT
br.com
@@ -15,6 +15,7 @@
Demo project for Spring Boot
11
+ 2021.0.1-SNAPSHOT
@@ -25,6 +26,30 @@
org.springframework.boot
spring-boot-starter-web
+
+ org.springframework.cloud
+ spring-cloud-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.9.2
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.9.2
+
+
+ org.webjars
+ bootstrap
+ 3.3.5
+
org.springframework.boot
@@ -48,6 +73,17 @@
test
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
@@ -57,5 +93,41 @@
+
+
+ spring-milestones
+ Spring Milestones
+ https://repo.spring.io/milestone
+
+ false
+
+
+
+ spring-snapshots
+ Spring Snapshots
+ https://repo.spring.io/snapshot
+
+ false
+
+
+
+
+
+ spring-milestones
+ Spring Milestones
+ https://repo.spring.io/milestone
+
+ false
+
+
+
+ spring-snapshots
+ Spring Snapshots
+ https://repo.spring.io/snapshot
+
+ false
+
+
+
diff --git a/src/main/java/br/com/sigaBemApi/DTO/Request/Carga.java b/src/main/java/br/com/sigaBemApi/DTO/Request/Carga.java
index 1a63a173..aa915a15 100644
--- a/src/main/java/br/com/sigaBemApi/DTO/Request/Carga.java
+++ b/src/main/java/br/com/sigaBemApi/DTO/Request/Carga.java
@@ -1,110 +1,3 @@
package br.com.sigaBemApi.DTO.Request;
-import javax.persistence.Entity;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.Size;
-import java.time.LocalDate;
-@Entity
-public class Carga {
- @javax.persistence.Id
- private Long Id;
-
- @NotEmpty(message = "Campo com preenchimento obrigatório!")
- @Size(max = 55, message = "Nome deve conter menos de 55 caracteres!")
- private String nomeDestinatario;
-
- @NotEmpty(message = "Campo com preenchimento obrigatório!")
- @Size(min = 8, max = 8, message = "CEP deve conter 8 digitos!")
- private String cepOrigem;
-
- @NotEmpty(message = "Campo com preenchimento obrigatório!")
- @Size(min = 8, max = 8, message = "CEP deve conter 8 digitos!")
- private String cepDestino;
-
- @NotEmpty(message = "Campo com preenchimento obrigatório!")
- @Size(min = 0, message = "Peso deve ser maior que zero!")
- public Double peso;
-
- public Double vlTotalFrete;
-
- public LocalDate dataPrevistaEntrega;
-
- public LocalDate dataConsulta;
-
-
- public Carga() {
-
- }
- //
- public Carga(String cepOrigem, String cepDestino, LocalDate dataPrevistaEntrega, Double vlTotalFrete) {
- this.cepOrigem = cepOrigem;
- this.cepDestino = cepDestino;
- this.dataPrevistaEntrega = dataPrevistaEntrega;
- this.vlTotalFrete = vlTotalFrete;
- }
-
- public Long getId() {
- return Id;
- }
-
- public void setId(Long id) {
- Id = id;
- }
-
- public String getNomeDestinatario() {
- return nomeDestinatario;
- }
-
- public void setNomeDestinatario(String nomeDestinatario) {
- this.nomeDestinatario = nomeDestinatario;
- }
-
- public String getCepOrigem() {
- return cepOrigem;
- }
-
- public void setCepOrigem(String cepOrigem) {
- this.cepOrigem = cepOrigem;
- }
-
- public String getCepDestino() {
- return cepDestino;
- }
-
- public void setCepDestino(String cepDestino) {
- this.cepDestino = cepDestino;
- }
-
- public Double getPeso() {
- return peso;
- }
-
- public void setPeso(Double peso) {
- this.peso = peso;
- }
-
- public Double getVlTotalFrete() {
- return vlTotalFrete;
- }
-
- public void setVlTotalFrete(Double vlTotalFrete) {
- this.vlTotalFrete = vlTotalFrete;
- }
-
- public LocalDate getDataPrevistaEntrega() {
- return dataPrevistaEntrega;
- }
-
- public void setDataPrevistaEntrega(LocalDate dataPrevistaEntrega) {
- this.dataPrevistaEntrega = dataPrevistaEntrega;
- }
-
- public LocalDate getDataConsulta() {
- return dataConsulta;
- }
-
- public void setDataConsulta(LocalDate dataConsulta) {
- this.dataConsulta = dataConsulta;
- }
-}
diff --git a/src/main/java/br/com/sigaBemApi/DTO/Response/AnaliseResponse.java b/src/main/java/br/com/sigaBemApi/DTO/Response/AnaliseResponse.java
index 055d8509..4c0d1748 100644
--- a/src/main/java/br/com/sigaBemApi/DTO/Response/AnaliseResponse.java
+++ b/src/main/java/br/com/sigaBemApi/DTO/Response/AnaliseResponse.java
@@ -1,8 +1,6 @@
package br.com.sigaBemApi.DTO.Response;
-import br.com.sigaBemApi.entity.DAO.Analise;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
-
import javax.validation.Valid;
import java.time.LocalDate;
@@ -11,7 +9,6 @@ public class AnaliseResponse {
/*
ATTRIBUTES
*/
-
private Long id;
private String cepOrigem;
private String cepDestino;
@@ -19,11 +16,9 @@ public class AnaliseResponse {
private Double vlTotalFrete;
private Long peso;
private String nomeDestinatario;
-
/*
CONSTRUCTORS
*/
-
public AnaliseResponse(String id, Long peso, String cepOrigem, String cepDestino, LocalDate dataPrevistaEntrega, Double vlTotalFrete) {
this.id = Long.valueOf(id);
this.cepOrigem = cepOrigem;
@@ -32,77 +27,51 @@ public AnaliseResponse(String id, Long peso, String cepOrigem, String cepDestino
this.vlTotalFrete = vlTotalFrete;
this.peso = peso;
this.nomeDestinatario = nomeDestinatario;
-
}
//EDITAR
public AnaliseResponse() {
}
-
-
/*
GETTER'S AND SETTER'S
*/
-
public String getCepOrigem() {
return cepOrigem;
}
-
public void setCepOrigem(String cepOrigem) {
this.cepOrigem = cepOrigem;
}
-
public String getCepDestino() {
return cepDestino;
}
-
public void setCepDestino(String cepDestino) {
this.cepDestino = cepDestino;
}
-
public LocalDate getDataPrevistaEntrega() {
return dataPrevistaEntrega;
}
-
public void setDataPrevistaEntrega(LocalDate dataPrevistaEntrega) {
- this.dataPrevistaEntrega = dataPrevistaEntrega;
- }
-
+ this.dataPrevistaEntrega = dataPrevistaEntrega;}
public Double getVlTotalFrete() {
return vlTotalFrete;
}
-
- public Double setVlTotalFrete(Double vlTotalFrete) {
- return vlTotalFrete;
-
- }
-
- public AnaliseResponse save(Analise analise) {
- // TODO Auto-generated method stub
- return null;
- }
-
+ public Double setVlTotalFrete(Double vlTotalFrete) {return vlTotalFrete;}
public Long getId() {
return id;
}
-
public void setId(@Valid Long id) {
this.id = id;
}
-
public Long getPeso() {
return peso;
}
-
public void setPeso(Long peso) {
this.peso = peso;
}
-
public String getNomeDestinatario() {
return nomeDestinatario;
}
-
public void setNomeDestinatario(String nomeDestinatario) {
this.nomeDestinatario = nomeDestinatario;
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/br/com/sigaBemApi/Util/PostalNotFound.java b/src/main/java/br/com/sigaBemApi/Util/PostalNotFound.java
index 96d41d87..82d73512 100644
--- a/src/main/java/br/com/sigaBemApi/Util/PostalNotFound.java
+++ b/src/main/java/br/com/sigaBemApi/Util/PostalNotFound.java
@@ -1,9 +1,7 @@
package br.com.sigaBemApi.Util;
-@SuppressWarnings("serial")
public class PostalNotFound extends RuntimeException{
public PostalNotFound(String postal) {
super("CEP: "+postal+" inválido");
-
}
}
diff --git a/src/main/java/br/com/sigaBemApi/controller/CargaController.java b/src/main/java/br/com/sigaBemApi/controller/CargaController.java
index a193c8b1..57597b4f 100644
--- a/src/main/java/br/com/sigaBemApi/controller/CargaController.java
+++ b/src/main/java/br/com/sigaBemApi/controller/CargaController.java
@@ -1,110 +1,21 @@
package br.com.sigaBemApi.controller;
-import br.com.sigaBemApi.DTO.Response.AnaliseResponse;
import br.com.sigaBemApi.entity.DAO.Analise;
-import br.com.sigaBemApi.entity.Postal;
import br.com.sigaBemApi.repository.CargaRepository;
-import br.com.sigaBemApi.service.BuscarPostal;
import br.com.sigaBemApi.service.CargaService;
-import ch.qos.logback.core.rolling.helper.MonoTypedConverter;
-import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.concurrent.MonoToListenableFutureAdapter;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import static org.springframework.http.ResponseEntity.ok;
+import java.util.List;
-@AllArgsConstructor
@RestController
@RequestMapping("/carga")
public class CargaController {
-
@Autowired
private CargaService cargaService;
- @PostMapping
- public Analise buscar(Analise analise){
+ @PostMapping("/testar")
+ public Analise buscarCepCalcularFreteESalvar(@RequestBody Analise analise){
return cargaService.buscarCepCalcularFreteESalvar(analise);
}
-
-// CargaController cargaController;
-//
-// @GetMapping("carga/cep")
-// public MonoToListenableFutureAdapter getAnaliseByCep(@PathVariable String Cep){
-
-
-// }
-
-
-
-
}
-
-
-
-
-// private final CargaService cargaService;
-//
-// private final CargaRepository cargaRepository;
-//
-// public CargaController(CargaRepository cargaRepository, CargaService cargaService) {
-// this.cargaRepository = cargaRepository;
-// this.cargaService = cargaService;
-// }
-//
-//// public CargaService getCargaService() {
-//// return cargaService;
-////
-//// }
-//
-// @PostMapping
-//// @ResponseStatus(HttpStatus.CREATED)
-// public double analiseResponse(@RequestBody AnaliseResponse pacote) {
-// return cargaService.calcularValorTotalFrete(pacote);
-// }
-//
-// // @GetMapping
-//// public List BucarId(){
-//// return cargaRepository.findAll();
-//// }
-//
-// @GetMapping("{carga}")
-// public HttpEntity