diff --git a/README.md b/README.md index 1c057c6..564293b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ -# Project_TMS_Fullstack_Entra21 -Projeto Final utilizando todas as tecnologias que aprendemos no curso da Entra21 - Blusoft +# TMS PROJECT - ENTRA21 FULLSTACK DEV + +--- +## SUMÁRIO + +sumario + +## RESUMO + +
+ Licença e Disponibilidade + +####      Esse projeto foi desenvolvido sem fins lucrativos, apenas para apresentação e demonstração dos conhecimentos técnicos adquiridos durante o curso do programa Entra21 - Blusoft na etapa final. + +####      + +
+ +
+ Das Tecnologias + +####      Durante o curso foi utilizado diversas tecnologias, métodos ágeis e ferramentas de desenvolvimento tais como: + +> #### Linguagens: +>> * ##### kaka-JAVA Java +>> * ##### kaka-js JavaScript +>> * ##### kaka-ts TypeScript +>> * ##### kaka-CSS CSS +> # +> #### Tecnologias: +>> * ##### kaka-vscode Spring Boot +>> * ##### kaka-Angular Angular +>> * ##### kaka-vscode MySQL +> # +> #### Ferramentas: +>> * ##### Eclipse IDE +>> * ##### kaka-vscode Visual Studio Code +>> * ##### Postman +>> * ##### kaka-vscode Google Cloud +> # +> #### Metodologia: +>> * ##### kaka-vscode Trello - Kanban + diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/LoginController.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/LoginController.java index 54c26fa..c046bcb 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/LoginController.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/LoginController.java @@ -1,5 +1,7 @@ package br.com.entra21.teamroxo.TMSProject.controllers; +import java.time.LocalDate; +import java.time.LocalTime; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -62,7 +64,9 @@ public List listAll() { if(!response.isEmpty()) { CountVisitors count = new CountVisitors(); - count.setCount(0); + count.setUser(credentials.getUser()); + count.setTime(LocalTime.now()); + count.setDate(LocalDate.now()); countVisitorsRepository.save(count); } diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/PessoaController.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/PessoaController.java index cb3313c..e8419e0 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/PessoaController.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/PessoaController.java @@ -33,7 +33,7 @@ @RequestMapping("/user") public class PessoaController { - private final String PATH = "http://localhost:8080/users"; + private final String PATH = "http://localhost:8080/user"; @Autowired private PessoaRepository pessoaRepository; diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/QuoteController.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/QuoteController.java new file mode 100644 index 0000000..4f3f5a1 --- /dev/null +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/QuoteController.java @@ -0,0 +1,57 @@ +package br.com.entra21.teamroxo.TMSProject.controllers; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import br.com.entra21.teamroxo.TMSProject.interfaces.RecentQuoteRepository; +import br.com.entra21.teamroxo.TMSProject.interfaces.RegisterQuoteRepository; +import br.com.entra21.teamroxo.TMSProject.template.RecentQuote; +import br.com.entra21.teamroxo.TMSProject.template.RegisterQuote; + +@RestController +@CrossOrigin(origins = "*") +@RequestMapping("/quote") +public class QuoteController { + + @Autowired + private RegisterQuoteRepository registerQuoteRepository; + + @Autowired + private RecentQuoteRepository recentQuoteRepository; + + @PostMapping("/recent") + public RecentQuote recentPackage(@RequestBody RecentQuote quote) { + + return recentQuoteRepository.save(quote); + + } + + @PostMapping("/register") + public RegisterQuote registerPackage(@RequestBody RegisterQuote quote) { + + return registerQuoteRepository.save(quote); + + } + + @GetMapping("/go") + public int goingPackages() { + + List response = new ArrayList(registerQuoteRepository.findAll().stream() + .filter(quote -> (quote.getPost().plusDays(quote.getAwait()).isAfter(LocalDate.now()) || + quote.getPost().plusDays(quote.getAwait()).isEqual(LocalDate.now()))) + .toList()); + + return response.size(); + + } + +} diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/ShipController.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/ShipController.java index 64dfcd9..2608b55 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/ShipController.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/ShipController.java @@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.fasterxml.jackson.databind.util.JSONPObject; + @RestController @CrossOrigin(origins = "*") @RequestMapping("/ship") @@ -24,7 +26,7 @@ public class ShipController { final String GOOGLE = "https://maps.googleapis.com/maps/api/directions/json?origin="; @GetMapping("/{cepOrigem}/{cepDestino}") - public ArrayList getGoogleAPI(@PathVariable ("cepOrigem") int param1, @PathVariable ("cepDestino") int param2 ){ + public JSONPObject getGoogleAPI(@PathVariable ("cepOrigem") int param1, @PathVariable ("cepDestino") int param2 ){ try { @@ -35,9 +37,11 @@ public ArrayList getGoogleAPI(@PathVariable ("cepOrigem") int param1, @P BufferedReader response = new BufferedReader(new InputStreamReader(get.getInputStream())); - ArrayList jsonEmString = converteJsonEmString(response); + String jsonEmString = converteJsonEmString(response); + + JSONPObject obj = new JSONPObject(jsonEmString, null); - return jsonEmString; + return obj; }catch (Exception e) { @@ -47,18 +51,19 @@ public ArrayList getGoogleAPI(@PathVariable ("cepOrigem") int param1, @P } - public static ArrayList converteJsonEmString(BufferedReader buffereReader) throws IOException { + public static String converteJsonEmString(BufferedReader buffereReader) throws IOException { String resposta; - ArrayList json = new ArrayList<>(); + String json = ""; while ((resposta = buffereReader.readLine()) != null) { - json.add(resposta); + json += (resposta); } return json; + } } diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/RecentQuoteRepository.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/RecentQuoteRepository.java new file mode 100644 index 0000000..2530b5e --- /dev/null +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/RecentQuoteRepository.java @@ -0,0 +1,9 @@ +package br.com.entra21.teamroxo.TMSProject.interfaces; + +import org.springframework.data.jpa.repository.JpaRepository; + +import br.com.entra21.teamroxo.TMSProject.template.RecentQuote; + +public interface RecentQuoteRepository extends JpaRepository { + +} diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/RegisterQuoteRepository.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/RegisterQuoteRepository.java new file mode 100644 index 0000000..785a265 --- /dev/null +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/RegisterQuoteRepository.java @@ -0,0 +1,9 @@ +package br.com.entra21.teamroxo.TMSProject.interfaces; + +import org.springframework.data.jpa.repository.JpaRepository; + +import br.com.entra21.teamroxo.TMSProject.template.RegisterQuote; + +public interface RegisterQuoteRepository extends JpaRepository { + +} diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/CountVisitors.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/CountVisitors.java index 6fb7bf5..91ecf7c 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/CountVisitors.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/CountVisitors.java @@ -1,5 +1,7 @@ package br.com.entra21.teamroxo.TMSProject.template; +import java.time.LocalDate; +import java.time.LocalTime; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -13,23 +15,52 @@ public class CountVisitors { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; - private long count; + private String user; + private LocalDate date; + private LocalTime time; public CountVisitors() { super(); } - public CountVisitors(long count) { + public CountVisitors(Integer id, String user, LocalDate date, LocalTime time) { super(); - this.count = count; + this.id = id; + this.user = user; + this.date = date; + this.time = time; } - public long getCount() { - return count; + public Integer getId() { + return id; } - public void setCount(long count) { - this.count = count; + public void setId(Integer id) { + this.id = id; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public LocalTime getTime() { + return time; + } + + public void setTime(LocalTime time) { + this.time = time; } } diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/GoogleAPI.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/GoogleAPI.java new file mode 100644 index 0000000..67625b9 --- /dev/null +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/GoogleAPI.java @@ -0,0 +1,46 @@ +package br.com.entra21.teamroxo.TMSProject.template; + +import java.util.List; + +public class GoogleAPI { + + private List geocoded_waypoints; + private List routes; + private String status; + + public GoogleAPI() { + super(); + } + + public GoogleAPI(List geocoded_waypoints, List routes, String status) { + super(); + this.geocoded_waypoints = geocoded_waypoints; + this.routes = routes; + this.status = status; + } + + public List getGeocoded_waypoints() { + return geocoded_waypoints; + } + + public void setGeocoded_waypoints(List geocoded_waypoints) { + this.geocoded_waypoints = geocoded_waypoints; + } + + public List getRoutes() { + return routes; + } + + public void setRoutes(List routes) { + this.routes = routes; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + +} diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/RegisterQuote.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/RegisterQuote.java index c305a35..1cf8191 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/RegisterQuote.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/RegisterQuote.java @@ -1,5 +1,6 @@ package br.com.entra21.teamroxo.TMSProject.template; +import java.time.LocalDate; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -15,6 +16,7 @@ public class RegisterQuote { private Integer id; private float price; private byte await; + private LocalDate post; private String origin; private String destiny; private byte carrier_id; @@ -25,8 +27,7 @@ public RegisterQuote() { super(); } - public RegisterQuote(Integer id, float price, byte await, String origin, String destiny, byte carrier_id, - float cub_height, int pessoa_id) { + public RegisterQuote(Integer id, float price, byte await, String origin, String destiny, byte carrier_id, float cub_height, int pessoa_id) { super(); this.id = id; this.price = price; @@ -102,4 +103,12 @@ public void setPessoa_id(int pessoa_id) { this.pessoa_id = pessoa_id; } + public LocalDate getPost() { + return post; + } + + public void setPost(LocalDate post) { + this.post = post; + } + } diff --git a/frontend/main/src/app/body/body.component.html b/frontend/main/src/app/body/body.component.html index 725cb64..1a907f1 100644 --- a/frontend/main/src/app/body/body.component.html +++ b/frontend/main/src/app/body/body.component.html @@ -111,7 +111,7 @@