From f9c9eff560cc7be6a7f580dc0caee869eab97099 Mon Sep 17 00:00:00 2001 From: kaka-jaques Date: Tue, 27 Sep 2022 23:41:55 -0300 Subject: [PATCH 01/19] UPDATE! --- README.md | 45 ++++++++++++++----- backend/TMSProject/pom.xml | 9 ++++ .../TMSProject/TmsProjectApplication.java | 29 ++++++------ .../controllers/LoginController.java | 6 +-- .../interfaces/LoginRepository.java | 11 +++++ 5 files changed, 69 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 8177a70..df9f062 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,11 @@ > >>3.1. GOOGLE CLOUD >> ->>>3.1.1. Google API +>>>3.1.1. Google API >>> ->>>>3.1.1.1. Directions API +>>>>3.1.1.1. Directions API >>>> ->>>>3.1.1.2. Distance Matrix API +>>>>3.1.1.2. Distance Matrix API >>>> >>>> >>>>3.1.1.3. Compute Engine API @@ -109,7 +109,7 @@ ## 1 - RESUMO -
+
1.1 - Da Licença, Disponibilidade e Finalidade ####      Esse projeto foi desenvolvido pelo grupo Roxo da Turma Java Noturno de 2022, composto por Bruno Roberto, Cristian Schauffert, Kalil Fakhouri e Mateus Felipe com a mentoria do professor Oliota, visando apenas a demonstração dos conhecimentos técnicos adquiridos durante o curso e a apresentação da etapa final à empresas. @@ -122,7 +122,7 @@
-
+
1.2 - Das Tecnologias Utilizadas ####      Durante o curso foi utilizado diversas tecnologias, métodos ágeis e ferramentas de desenvolvimento tais como: @@ -156,7 +156,7 @@
2.1 - Visão Geral -####      +####     
@@ -175,9 +175,32 @@ 3.1 - GOOGLE CLOUD
->## 3.1.1 - Google API ->>### 3.1.1.1 - Directions API ->> ->>####         Directions API +Clique aqui para aprender a configurar o Google Cloud - \ No newline at end of file +>## 3.1.1 - Google API +>>### 3.1.1.1 - Directions API +>> +>>####          A API Directions é um serviço da Web que usa uma solicitação HTTP para retornar rotas no formato JSON ou XML entre os locais. As rotas estão disponíveis de várias maneiras: +>> +>> * #### como uma API independente. +>> * #### como parte da API Maps JavaScript do lado do cliente. +>> * #### para uso do servidor como parte das bibliotecas de cliente dos Serviços da Web do Google Maps. +>> +>> ####          Esta API aceita tanto endereços do tipo texto como também latitudes e longitudes previamente formatadas de acordo com o padrão estabelecido. +>> +>>### 3.1.1.2 - Distance Matrix API +>> +>>####          A API Distance Matrix fornece a distância e o tempo de viagem de uma matriz de origens e destinos e consiste em linhas que contêm os valores duration e distance para cada par. A Distance Matrix está disponível de várias formas: +>> +>> * #### como uma API independente. +>> * #### como parte da API Maps JavaScript do lado do cliente. +>> * #### para uso do servidor como parte das bibliotecas de cliente dos Serviços da Web do Google Maps. +>> +>> ####          A API retorna informações com base na rota recomendada entre os pontos inicial e final. Você pode solicitar dados de distância para diferentes meios de transporte, solicitar dados de distância em diferentes unidades, como quilômetros ou milhas, e estimar o tempo de viagem no trânsito. +>> +>>### 3.1.1.3 - Compute Engine API +>> +>> ####          Cria e executa máquinas virtuais no Google Cloud Platform. O Google Compute Engine oferece máquinas virtuais que são executadas nos data centers do Google conectados à rede de fibra óptica global. As ferramentas e o fluxo de trabalho oferecidos permitem o escalonamento de instâncias únicas para computação em nuvem com balanceamento de carga global. +>> ####          Essas VMs são inicializadas rapidamente, vêm com armazenamento em disco permanente e proporcionam desempenho consistente. As máquinas estão disponíveis em muitas configurações, incluindo tamanhos predefinidos e também podem ser criadas com tipos de máquinas personalizados de acordo com suas necessidades específicas. +>> +
\ No newline at end of file diff --git a/backend/TMSProject/pom.xml b/backend/TMSProject/pom.xml index e3214f1..5735092 100644 --- a/backend/TMSProject/pom.xml +++ b/backend/TMSProject/pom.xml @@ -52,6 +52,15 @@ jackson-databind 2.13.3 + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.security + spring-security-test + test + diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/TmsProjectApplication.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/TmsProjectApplication.java index ebccb8c..f7c9f2b 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/TmsProjectApplication.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/TmsProjectApplication.java @@ -1,27 +1,16 @@ package br.com.entra21.teamroxo.TMSProject; -import java.util.ArrayList; - -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.jdbc.core.JdbcTemplate; - -import br.com.entra21.teamroxo.TMSProject.interfaces.PessoaRepository; -import br.com.entra21.teamroxo.TMSProject.template.Login; -import br.com.entra21.teamroxo.TMSProject.template.Pessoa; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; -@SpringBootApplication +@SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) public class TmsProjectApplication implements CommandLineRunner { - private static PessoaRepository pessoaRepository; - - public static ArrayList login = new ArrayList(); - - @Autowired - private JdbcTemplate jdbc; - public static void main(String[] args) { SpringApplication.run(TmsProjectApplication.class, args); } @@ -30,5 +19,13 @@ public static void main(String[] args) { public void run(String... args) throws Exception { } + + @Bean + public PasswordEncoder getPasswordEncoder() { + + BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); + return encoder; + + } } 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 c046bcb..74c6d33 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 @@ -54,10 +54,8 @@ public List listAll() { @ResponseStatus(code = HttpStatus.OK) public @ResponseBody List login(@RequestBody Login credentials){ - List response = new ArrayList(loginRepository.findAll()).stream() - .filter(login -> (login.getUser().equals(credentials.getUser())) && - login.getSenha().equals(credentials.getSenha())) - .toList(); + List response = loginRepository.findLogin(credentials.getUser(), credentials.getSenha()).stream().toList(); + response.forEach(pessoa -> { setMaturidadeLvl3(pessoa); }); diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/LoginRepository.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/LoginRepository.java index 9f23f4c..66c88d2 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/LoginRepository.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/LoginRepository.java @@ -1,9 +1,20 @@ package br.com.entra21.teamroxo.TMSProject.interfaces; +import java.util.List; + import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; import br.com.entra21.teamroxo.TMSProject.template.Login; +@Repository +@EnableJpaRepositories public interface LoginRepository extends JpaRepository { + @Query("FROM Login WHERE user = :usuario and senha = :password") + List findLogin(@Param("usuario") String usuario, @Param("password") String password); + } From d3e48b7dba7017ca6b140db8f1b38d5ff275a9cb Mon Sep 17 00:00:00 2001 From: Mateus Felipe Date: Wed, 28 Sep 2022 21:30:53 -0300 Subject: [PATCH 02/19] Users and Carriers - Get and Post --- .../controllers/CarriersControllers.java | 12 +++ .../interfaces/CarriersRepository.java | 8 ++ frontend/main/src/app/carrier.service.ts | 12 +++ .../src/app/carriers/carriers.component.html | 37 ++++---- .../src/app/carriers/carriers.component.ts | 84 ++++++++++++------- frontend/main/src/app/quote.service.ts | 6 ++ .../main/src/app/rct-qt/rct-qt.component.html | 27 +++++- .../main/src/app/rct-qt/rct-qt.component.ts | 21 ++++- .../main/src/app/ship-qt/ship-qt.component.ts | 3 +- frontend/main/src/app/users.service.spec.ts | 16 ++++ frontend/main/src/app/users.service.ts | 29 +++++++ .../main/src/app/users/users.component.html | 15 ++-- .../main/src/app/users/users.component.ts | 65 +++++++++----- 13 files changed, 262 insertions(+), 73 deletions(-) create mode 100644 frontend/main/src/app/users.service.spec.ts create mode 100644 frontend/main/src/app/users.service.ts diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/CarriersControllers.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/CarriersControllers.java index 5a0e7ea..0def445 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/CarriersControllers.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/controllers/CarriersControllers.java @@ -3,13 +3,18 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; 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.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import br.com.entra21.teamroxo.TMSProject.interfaces.CarriersRepository; import br.com.entra21.teamroxo.TMSProject.template.Carriers; +import br.com.entra21.teamroxo.TMSProject.template.Pessoa; @RestController @CrossOrigin(origins = "*") @@ -26,4 +31,11 @@ public List listCarriers(){ } + @PostMapping() + @ResponseStatus(code = HttpStatus.CREATED) + public Carriers register(@RequestBody Carriers dados) { + + return carriersRepository.save(dados); + + } } diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/CarriersRepository.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/CarriersRepository.java index 62d7a39..9aa8298 100644 --- a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/CarriersRepository.java +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/interfaces/CarriersRepository.java @@ -1,9 +1,17 @@ package br.com.entra21.teamroxo.TMSProject.interfaces; +import java.util.List; + import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + import br.com.entra21.teamroxo.TMSProject.template.Carriers; public interface CarriersRepository extends JpaRepository { + +// @Query("FROM carriers WHERE idade >= :idadeParam") +// List maiorIdade (@Param("idadeParam")Integer idade); } diff --git a/frontend/main/src/app/carrier.service.ts b/frontend/main/src/app/carrier.service.ts index 0bd06ed..2662659 100644 --- a/frontend/main/src/app/carrier.service.ts +++ b/frontend/main/src/app/carrier.service.ts @@ -16,4 +16,16 @@ export class CarrierService { return this.http.get(this.apiURL) } + + adicionar(object:any){ + this.http.post(this.apiURL,object) + .subscribe((response)=>{ + + + console.log(response); + + }) + + + } } diff --git a/frontend/main/src/app/carriers/carriers.component.html b/frontend/main/src/app/carriers/carriers.component.html index 2949c89..4e87155 100644 --- a/frontend/main/src/app/carriers/carriers.component.html +++ b/frontend/main/src/app/carriers/carriers.component.html @@ -1,43 +1,52 @@ + - - + + - + + + - +
Razão socialTaxa E-mailCNPJTaxa - Tabela de freteCnpj
- + + + + +

+ + + - - - + + + + - + + - - + +
ID Razão socialTaxa E-mailCNPJTaxa - Tabela de freteAçõesCnpj
{{i}}{{carrier.name}}{{carrier.razao}}{{carrier.taxa}} {{carrier.email}} {{carrier.cnpj}}{{carrier.taxValorFrete}} - - -
\ No newline at end of file diff --git a/frontend/main/src/app/carriers/carriers.component.ts b/frontend/main/src/app/carriers/carriers.component.ts index ec78f22..b172b05 100644 --- a/frontend/main/src/app/carriers/carriers.component.ts +++ b/frontend/main/src/app/carriers/carriers.component.ts @@ -1,5 +1,8 @@ +import { HttpClient } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; +import { CarrierService } from '../carrier.service'; +import { QuoteService } from '../quote.service'; @Component({ selector: 'app-carriers', @@ -7,46 +10,65 @@ import { Router } from '@angular/router'; styleUrls: ['./carriers.component.css'] }) export class CarriersComponent implements OnInit { - carriers!:Array - name!:string - email!:string - cnpj!:string - taxValorFrete!:number - constructor( - private router:Router - ) { } + carriers!: Array + cnpj!: string + email!: string + razao!: string + taxa!: number + + constructor(public carrierService: CarrierService, public quoteService: QuoteService, private router: Router, private http: HttpClient) { } ngOnInit(): void { this.carriers = new Array() - this.carriers.push({name:"Total Express", email:"total@express.com", cnpj:"4564564566454655", taxValorFrete:0.081}) - this.carriers.push({name:"Jadlog", email:"jadlog@jadlog.com", cnpj:"4564664656565456", taxValorFrete:0.084}) - this.carriers.push({name:"Braspress", email:"braspress@braspress.com", cnpj:"1231323132312", taxValorFrete:0.089}) - this.carriers.push({name:"Correios", email:"correios@correios.com", cnpj:"7897987899789", taxValorFrete:0.078}) + // this.carriers.push({name:"Total Express", email:"total@express.com", cnpj:"4564564566454655", taxValorFrete:0.081}) + // this.carriers.push({name:"Jadlog", email:"jadlog@jadlog.com", cnpj:"4564664656565456", taxValorFrete:0.084}) + // this.carriers.push({name:"Braspress", email:"braspress@braspress.com", cnpj:"1231323132312", taxValorFrete:0.089}) + // this.carriers.push({name:"Correios", email:"correios@correios.com", cnpj:"7897987899789", taxValorFrete:0.078}) + + + this.carrierService.listCarrier().pipe().subscribe((response: any) => { + + console.log(response); + + + + var count = Object.keys(response).length; + + for (let i = 0; i < count; i++) { + + this.razao = response[i].razao; + this.taxa = response[i].taxa; + this.email = response[i].email; + this.cnpj = response[i].cnpj; + + this.carriers.push({ razao: this.razao, taxa: this.taxa, email: this.email, cnpj: this.cnpj}); + + } + + this.razao = ""; + this.taxa = 0; + this.email = ""; + this.cnpj = ""; + + }) } - adicionar(){ - if(this.name){ - this.carriers.push({name:this.name, email:this.email, cnpj:this.cnpj, taxValorFrete:this.taxValorFrete}) - this.name ="" - this.email="" - this.cnpj="" - this.taxValorFrete= 0 - } - let listaCarrier:any = [ - {name:this.name, email:this.email, cnpj:this.cnpj, taxValorFrete:this.taxValorFrete} - ] - this.router.navigate(['ship-qt', JSON.stringify(listaCarrier)]) + adicionar(razao: string, taxa: number, email: string, cnpj: string) { + + + let build ={ + "razao":razao, + "taxa":taxa, + "email":email, + "cnpj":cnpj + } - - deletar(index:number){ - this.carriers.splice(index,1) - } - - alterar(index:number){ - // this.carriers.splice(index,1) + this.carrierService.adicionar(build) + + this.carriers.push({razao:this.razao, taxa:this.taxa, email:this.email, cnpj:this.cnpj}); } } \ No newline at end of file diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index 6cfa1b6..0ae04f1 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -21,6 +21,12 @@ export class QuoteService { } + recQuote():any{ + + return this.http.get(this.apiURL) + + } + regRecentQuotes(object:any){ this.http.post(this.apiURL2+'/recent',object) .subscribe((response)=>{ diff --git a/frontend/main/src/app/rct-qt/rct-qt.component.html b/frontend/main/src/app/rct-qt/rct-qt.component.html index 1b35802..c81acf7 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.html +++ b/frontend/main/src/app/rct-qt/rct-qt.component.html @@ -1 +1,26 @@ -

rct-qt works!

+ + + + + + + + + + + + + + + +
AçãoIDPreço do fretePrazoOrigemDestinoTransportadoraPeso cubado
\ No newline at end of file diff --git a/frontend/main/src/app/rct-qt/rct-qt.component.ts b/frontend/main/src/app/rct-qt/rct-qt.component.ts index be12925..cc30a23 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -1,4 +1,8 @@ +import { HttpClient } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { CarrierService } from '../carrier.service'; +import { QuoteService } from '../quote.service'; @Component({ selector: 'app-rct-qt', @@ -7,9 +11,24 @@ import { Component, OnInit } from '@angular/core'; }) export class RctQtComponent implements OnInit { - constructor() { } + + constructor(public quoteService: QuoteService, private router: Router, private http: HttpClient) { } ngOnInit(): void { + + this.quoteService.recQuote().pipe().subscribe((response: any) => { + + var count = Object.keys(response).length; + + for (let i = 0; i < count; i++) { + + + + + + } + + }) } } diff --git a/frontend/main/src/app/ship-qt/ship-qt.component.ts b/frontend/main/src/app/ship-qt/ship-qt.component.ts index 00ee164..16beccd 100644 --- a/frontend/main/src/app/ship-qt/ship-qt.component.ts +++ b/frontend/main/src/app/ship-qt/ship-qt.component.ts @@ -79,7 +79,8 @@ export class ShipQtComponent implements OnInit { console.log(this.priceFix + this.distance * response[i].taxa * this.cubagem); - this.precoFrete = this.priceFix + this.distance * response[i].taxa * this.cubagem; + this.precoFrete = (this.priceFix + this.distance * response[i].taxa * this.cubagem); + this.quotes.push({ precoFrete: this.precoFrete, tempo: this.tempo, start_adress: this.start_adress, end_address: this.end_address, carrier: response[i].razao, vol: this.vol, cubagem: this.cubagem, carrierID: response[i].id, pessoaID: this.loginService.pessoaID }); diff --git a/frontend/main/src/app/users.service.spec.ts b/frontend/main/src/app/users.service.spec.ts new file mode 100644 index 0000000..f81244a --- /dev/null +++ b/frontend/main/src/app/users.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { UsersService } from './users.service'; + +describe('UsersService', () => { + let service: UsersService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(UsersService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/frontend/main/src/app/users.service.ts b/frontend/main/src/app/users.service.ts new file mode 100644 index 0000000..2f2d66f --- /dev/null +++ b/frontend/main/src/app/users.service.ts @@ -0,0 +1,29 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; + +@Injectable({ + providedIn: 'root' +}) +export class UsersService { + + apiURL:string = 'http://localhost:8080/user' + + constructor(private router: Router, private http: HttpClient) { } + + listUsers():any{ + + return this.http.get(this.apiURL) + + } + + adicionar(object:any){ + this.http.post(this.apiURL,object) + .subscribe((response)=>{ + + + console.log(response); + + }) +} +} \ No newline at end of file diff --git a/frontend/main/src/app/users/users.component.html b/frontend/main/src/app/users/users.component.html index 72942f2..9e1debe 100644 --- a/frontend/main/src/app/users/users.component.html +++ b/frontend/main/src/app/users/users.component.html @@ -3,6 +3,7 @@ Nome E-mail CPF + Data nascimento @@ -10,7 +11,8 @@ - + + @@ -19,7 +21,7 @@ - +

@@ -28,17 +30,18 @@ - + - + + diff --git a/frontend/main/src/app/users/users.component.ts b/frontend/main/src/app/users/users.component.ts index a1c6bbc..de25fa8 100644 --- a/frontend/main/src/app/users/users.component.ts +++ b/frontend/main/src/app/users/users.component.ts @@ -1,4 +1,7 @@ +import { HttpClient } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { UsersService } from '../users.service'; @Component({ selector: 'app-users', @@ -9,38 +12,62 @@ export class UsersComponent implements OnInit { users!:Array name!:string email!:string -cpf!:string +document!:string +birth!:string - constructor() { } + constructor(public usersService: UsersService, private router: Router, private http: HttpClient) { } ngOnInit(): void { this.users = new Array() - this.users.push({name:"Mateus Felipe", email:"mateusgoettems@gmail.com", cpf:"03215415454"}) - this.users.push({name:"Bruno Roberto", email:"bruno@gmail.com", cpf:"03215415454"}) - this.users.push({name:"Cristian Schaufer", email:"cristian@gmail.com", cpf:"03215415454"}) - this.users.push({name:"Kalil", email:"kalil@gmail.com", cpf:"03215415454"}) + this.usersService.listUsers().pipe().subscribe((response: any) => { + console.log(response); + + var count = Object.keys(response).length; + + for (let i = 0; i < count; i++) { + + this.name = response[i].nome; + this.email = response[i].email; + this.document = response[i].document; + this.birth = response[i].birth; + + this.users.push({name:this.name, email:this.email, document:this.document, birth:this.birth}); + + } + + this.name = ""; + this.email = ""; + this.document = ""; + this.birth = ""; + + }) + } - adicionar(){ - if(this.name != null && this.email != null && this.cpf != null){ - this.users.push({name:this.name, email:this.email, cpf:this.cpf}) - this.name ="" - this.email="" - this.cpf="" - }else{ - alert('DIGITE TODOS OS DADOS!') - } + adicionar(name: string, email: string, document: string, birth: string) { + + + let build ={ + "nome":name, + "email":email, + "document":document, + // "birth":birth, + } + this.usersService.adicionar(build) - deletar(index:number){ - this.users.splice(index,1) + this.users.push({name:this.name, email:this.email, document:this.document, birth:this.birth}); } - alterar(index:number){ - // this.users.splice(index,1) + deletar(){ + } + alterar(){ + + } + } From 7ac0742fa20e5e8aba3ba40b2b59b5f0d3bc96f9 Mon Sep 17 00:00:00 2001 From: kaka-jaques Date: Wed, 28 Sep 2022 22:20:24 -0300 Subject: [PATCH 03/19] UPDATE! --- .../controllers/ShipController.java | 5 -- .../main/src/app/about/about.component.html | 89 ++++++++++++++++++- .../main/src/app/body/body.component.html | 51 +++-------- .../src/app/carriers/carriers.component.ts | 30 +++---- .../src/app/insight/insight.component.html | 4 +- .../main/src/app/insight/insight.component.ts | 21 +++-- 6 files changed, 130 insertions(+), 70 deletions(-) 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 a9773ef..0d65375 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 @@ -3,10 +3,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.net.HttpURLConnection; import java.net.URL; -import java.util.ArrayList; -import java.util.List; import javax.net.ssl.HttpsURLConnection; @@ -16,10 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.util.JSONPObject; @RestController @CrossOrigin(origins = "*") diff --git a/frontend/main/src/app/about/about.component.html b/frontend/main/src/app/about/about.component.html index 6094aa9..7ce18a8 100644 --- a/frontend/main/src/app/about/about.component.html +++ b/frontend/main/src/app/about/about.component.html @@ -1 +1,88 @@ -

about works!

+
+
+
+
+ +

Bruno Roberto

+
Frontend Dev.
+
+ + + +
+
+ +

Cristian Schauffert

+
Web Designer
+
+ + + +
+
+ +

Kalil J. Fakhouri

+
Lead Developer
+
+ + + +
+
+ +

Mateus Felipe

+
Lead Developer
+
+ + + +
+
+
+
+
+
+

Sobre o Projeto

+
+

Licença,Disponibilidade e finalidade

+
+
Esse projeto foi desenvolvido pelo grupo Roxo da Turma Java Noturno de 2022, composto por Bruno Roberto, + Cristian Schauffert, Kalil Fakhouri e Mateus Felipe com a mentoria do professor Oliota, visando apenas a + demonstração dos conhecimentos técnicos adquiridos durante o curso e a apresentação da etapa final à + empresas. +

+ A cópia do recurso está disponível a todos, podendo ser modificada e alterada. Fica proibida a venda, + distribuição ou repasse da mesma. + A maioria dos recurso e tecnologias são de código livre (open-source) ou teste de avaliação por tempo + determinado (Google Cloud), afim de trazer a melhor experiência do uso de um software funcional. +

+ Devido ao nosso objetivo de comprovar os conhecimentos adquiridos, algumas partes do software são simulados + devido ao tempo e resposta que levaria na realidade, acelerando, assim, o processo de entrega, por exemplo, para que + possa ser vista em tempo real o processamento de dados, tanto localmente quanto em nuvem. + +
+
+
diff --git a/frontend/main/src/app/body/body.component.html b/frontend/main/src/app/body/body.component.html index 1a907f1..f9ff4b2 100644 --- a/frontend/main/src/app/body/body.component.html +++ b/frontend/main/src/app/body/body.component.html @@ -148,68 +148,39 @@
- + From 3ae76c44bb7c056f02355160f6754fe29a25ab36 Mon Sep 17 00:00:00 2001 From: Mateus Felipe Date: Mon, 3 Oct 2022 18:40:28 -0300 Subject: [PATCH 12/19] Updated --- frontend/main/src/app/quote.service.ts | 10 ++++ .../main/src/app/rct-qt/rct-qt.component.html | 26 ++++++---- .../main/src/app/rct-qt/rct-qt.component.ts | 52 ++++++++++++++++--- 3 files changed, 70 insertions(+), 18 deletions(-) diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index 0ae04f1..266b2e5 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -12,6 +12,7 @@ export class QuoteService { apiURL:string = 'http://localhost:8080/ship' apiURL2:string = 'http://localhost:8080/quote' + apiURL3:string = 'http://localhost:8080/' constructor(private router: Router, private http: HttpClient) { } @@ -39,6 +40,15 @@ export class QuoteService { } + regPackage(object:any){ + this.http.post(this.apiURL3+'/register',object) + .subscribe((response)=>{ + + + console.log(response); + +}) + } } diff --git a/frontend/main/src/app/rct-qt/rct-qt.component.html b/frontend/main/src/app/rct-qt/rct-qt.component.html index c81acf7..3b11fe2 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.html +++ b/frontend/main/src/app/rct-qt/rct-qt.component.html @@ -4,23 +4,27 @@ + - + - +
Nome E-mail CPFAçõesData nascimento
{{i}} {{user.name}} {{user.email}}{{user.cpf}}{{user.document}}{{user.birth}} - - + +
{{i}}{{i+1}} R${{quote.precoFrete}} {{quote.tempo}} dias úteis {{quote.start_adress}}ID Preço do frete PrazoTransportadora Origem DestinoTransportadora Peso cubadoUsuário
\ No newline at end of file diff --git a/frontend/main/src/app/rct-qt/rct-qt.component.ts b/frontend/main/src/app/rct-qt/rct-qt.component.ts index cc30a23..a6e1bd2 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -11,24 +11,62 @@ import { QuoteService } from '../quote.service'; }) export class RctQtComponent implements OnInit { - + + recQuotes!: Array + id!: number + price!: number + await!: number + origin!: string + destiny!: string + carrier_id!: number + cub_height!: number + pessoa_id!: number + nomePessoa!: string + razaoTransportadora!: string + + constructor(public quoteService: QuoteService, private router: Router, private http: HttpClient) { } ngOnInit(): void { - this.quoteService.recQuote().pipe().subscribe((response: any) => { + // this.quoteService.recQuote().pipe().subscribe((response: any) => { - var count = Object.keys(response).length; + // var count = Object.keys(response).length; - for (let i = 0; i < count; i++) { + // for (let i = 0; i < count; i++) { - + // this.id = response[i].id + // this.price = response[i].price + // this.await = response[i].await + // this.origin = response[i].origin + // this.destiny = response[i].destiny + // this.cub_height = response[i].cub_height - } + // } + + // }) + } + + + regPackage(price: number, time: number, origin: string, destiny: string, carrier_id: number, cub_height: number, pessoa_id: number) { + + let build = { + "price": price, + "time": time, + "origin": origin, + "destiny": destiny, + "carrier_id": carrier_id, + "cub_height": cub_height, + "pessoa_id": pessoa_id + } + + this.quoteService.regPackage(build) + + + - }) } } From 33bf2232dcec5f58549af492bef11e1654bd480a Mon Sep 17 00:00:00 2001 From: Mateus Felipe Date: Mon, 3 Oct 2022 19:19:15 -0300 Subject: [PATCH 13/19] Updated Carriers and Users --- .../src/app/carriers/carriers.component.html | 8 +++++-- .../src/app/carriers/carriers.component.ts | 9 ++++++++ frontend/main/src/app/quote.service.ts | 2 +- .../main/src/app/rct-qt/rct-qt.component.ts | 22 +++++++++---------- .../main/src/app/users/users.component.html | 3 ++- .../main/src/app/users/users.component.ts | 1 + 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/frontend/main/src/app/carriers/carriers.component.html b/frontend/main/src/app/carriers/carriers.component.html index 4e87155..6d77686 100644 --- a/frontend/main/src/app/carriers/carriers.component.html +++ b/frontend/main/src/app/carriers/carriers.component.html @@ -34,18 +34,22 @@ Taxa E-mail Cnpj + Ação - {{i}} + {{i+1}} {{carrier.razao}} {{carrier.taxa}} {{carrier.email}} {{carrier.cnpj}} - + + + + diff --git a/frontend/main/src/app/carriers/carriers.component.ts b/frontend/main/src/app/carriers/carriers.component.ts index d45bf09..2901bd0 100644 --- a/frontend/main/src/app/carriers/carriers.component.ts +++ b/frontend/main/src/app/carriers/carriers.component.ts @@ -71,4 +71,13 @@ export class CarriersComponent implements OnInit { this.carriers.push({razao:this.razao, taxa:this.taxa, email:this.email, cnpj:this.cnpj}); } + deletar(){ + + + } + + alterar(){ + + } + } diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index c49bf09..f851d95 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -62,7 +62,7 @@ export class QuoteService { this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce) //FIM DO BOUNCE - return this.http.get(this.apiURL) + return this.http.get(this.apiURL2+`/recent`) } diff --git a/frontend/main/src/app/rct-qt/rct-qt.component.ts b/frontend/main/src/app/rct-qt/rct-qt.component.ts index a6e1bd2..5364b01 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -29,24 +29,24 @@ export class RctQtComponent implements OnInit { ngOnInit(): void { - // this.quoteService.recQuote().pipe().subscribe((response: any) => { + this.quoteService.recQuote().pipe().subscribe((response: any) => { - // var count = Object.keys(response).length; + var count = Object.keys(response).length; - // for (let i = 0; i < count; i++) { + for (let i = 0; i < count; i++) { - // this.id = response[i].id - // this.price = response[i].price - // this.await = response[i].await - // this.origin = response[i].origin - // this.destiny = response[i].destiny - // this.cub_height = response[i].cub_height + this.id = response[i].id + this.price = response[i].price + this.await = response[i].await + this.origin = response[i].origin + this.destiny = response[i].destiny + this.cub_height = response[i].cub_height - // } + } - // }) + }) } diff --git a/frontend/main/src/app/users/users.component.html b/frontend/main/src/app/users/users.component.html index 9e1debe..a825d34 100644 --- a/frontend/main/src/app/users/users.component.html +++ b/frontend/main/src/app/users/users.component.html @@ -31,10 +31,11 @@ E-mail CPF Data nascimento + Ação - {{i}} + {{i+1}} {{user.name}} {{user.email}} {{user.document}} diff --git a/frontend/main/src/app/users/users.component.ts b/frontend/main/src/app/users/users.component.ts index de25fa8..08f69e9 100644 --- a/frontend/main/src/app/users/users.component.ts +++ b/frontend/main/src/app/users/users.component.ts @@ -31,6 +31,7 @@ birth!:string this.email = response[i].email; this.document = response[i].document; this.birth = response[i].birth; + this.users.push({name:this.name, email:this.email, document:this.document, birth:this.birth}); From 1c23cbe9cd5cee9d4f686fd9bedfc2235479abea Mon Sep 17 00:00:00 2001 From: kaka-jaques Date: Mon, 3 Oct 2022 19:33:17 -0300 Subject: [PATCH 14/19] UPDATE! RECENT QUOTE BY USER! --- .../TMSProject/controllers/QuoteController.java | 10 ++++++---- .../interfaces/RecentQuoteRepository.java | 11 +++++++++++ .../teamroxo/TMSProject/template/SystemLink.java | 13 +++++++++++++ frontend/main/src/app/loginservice.service.ts | 7 ++++++- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/SystemLink.java 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 index 4f3f5a1..5ce2670 100644 --- 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 @@ -7,6 +7,7 @@ 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.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -30,16 +31,17 @@ public class QuoteController { @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("/recent/{id}") + public List recentQuote(@PathVariable("id") int id){ + return recentQuoteRepository.findOwnQuote(id); } @GetMapping("/go") 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 index 2530b5e..296ad11 100644 --- 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 @@ -1,9 +1,20 @@ package br.com.entra21.teamroxo.TMSProject.interfaces; +import java.util.List; + import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; import br.com.entra21.teamroxo.TMSProject.template.RecentQuote; +@Repository +@EnableJpaRepositories public interface RecentQuoteRepository extends JpaRepository { + @Query("FROM RecentQuote WHERE pessoa_id = :idUser") + List findOwnQuote(@Param("idUser") int idUser); + } diff --git a/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/SystemLink.java b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/SystemLink.java new file mode 100644 index 0000000..5344a13 --- /dev/null +++ b/backend/TMSProject/src/main/java/br/com/entra21/teamroxo/TMSProject/template/SystemLink.java @@ -0,0 +1,13 @@ +package br.com.entra21.teamroxo.TMSProject.template; + +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +public class SystemLink { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +} diff --git a/frontend/main/src/app/loginservice.service.ts b/frontend/main/src/app/loginservice.service.ts index 32a64b6..656cd3c 100644 --- a/frontend/main/src/app/loginservice.service.ts +++ b/frontend/main/src/app/loginservice.service.ts @@ -8,17 +8,21 @@ import { LoginComponent } from './login/login.component'; @Injectable({ providedIn: 'root' }) + export class LoginserviceService implements CanActivate { readonly TMSLoginAPI: string = "http://localhost:8080" readonly APIBounceInit: string = "http://localhost:8080/login/init" + //DADOS BÁSICOS nome!: string user!: string email!: string password!: string birth!: Date document!: string + + //DADOS DE CONTROLE succeed!: boolean progress!: boolean admin!: boolean @@ -26,6 +30,7 @@ export class LoginserviceService implements CanActivate { pessoaID!: number adminEnter:boolean = false + //DADOS ESTATÍSTICOS idBounce!: number userBounce!: string dateBounce!: string @@ -79,7 +84,7 @@ export class LoginserviceService implements CanActivate { this.email = resp.email this.password = response[0].senha }) - + let bounce: any = { "user": response[0].user } From ea47c46cb621ee9647d4b2be688ad6c88da4b294 Mon Sep 17 00:00:00 2001 From: kaka-jaques Date: Mon, 3 Oct 2022 20:30:13 -0300 Subject: [PATCH 15/19] UPDATE! RECENT QUOTE! --- .../TMSProject/controllers/QuoteController.java | 1 + frontend/main/src/app/body/body.component.html | 2 +- frontend/main/src/app/body/body.component.ts | 3 +++ .../main/src/app/notification.service.spec.ts | 16 ++++++++++++++++ frontend/main/src/app/notification.service.ts | 13 +++++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 frontend/main/src/app/notification.service.spec.ts create mode 100644 frontend/main/src/app/notification.service.ts 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 index 5ce2670..08d3e31 100644 --- 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 @@ -36,6 +36,7 @@ public RecentQuote recentPackage(@RequestBody RecentQuote quote) { @PostMapping("/register") public RegisterQuote registerPackage(@RequestBody RegisterQuote quote) { + quote.setPost(LocalDate.now()); return registerQuoteRepository.save(quote); } diff --git a/frontend/main/src/app/body/body.component.html b/frontend/main/src/app/body/body.component.html index b4d8527..442143e 100644 --- a/frontend/main/src/app/body/body.component.html +++ b/frontend/main/src/app/body/body.component.html @@ -67,7 +67,7 @@