Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Adrian
/
EjemploDAE2020
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9936b8a3
authored
Dec 14, 2020
by
Adrian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Servidor Api Bugs solucionados
parent
68ee1644
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
22 deletions
src/main/java/es/ujaen/dae/ujacoin/beans/Mapeador.java
src/main/java/es/ujaen/dae/ujacoin/beans/ServicioRestAPI.java
src/main/java/es/ujaen/dae/ujacoin/entidadesDTO/ClienteDTO.java
src/main/java/es/ujaen/dae/ujacoin/entidadesDTO/MovimientoDTO.java
src/main/java/es/ujaen/dae/ujacoin/beans/Mapeador.java
View file @
9936b8a3
...
...
@@ -25,20 +25,26 @@ public class Mapeador {
public
ClienteDTO
aClienteDTO
(
Cliente
cliente
)
{
ClienteDTO
clienteDTO
=
new
ClienteDTO
(
cliente
.
getDni
(),
ClienteDTO
clienteDTO
=
new
ClienteDTO
(
cliente
.
getDni
(),
cliente
.
getNombre
(),
cliente
.
getFechaNacimiento
(),
cliente
.
getDireccion
(),
cliente
.
getTelefono
(),
cliente
.
getEmail
(),
cliente
.
getClave
());
cliente
.
getEmail
());
for
(
String
cuenta
:
cliente
.
getCuentasAsociadas
().
keySet
())
{
clienteDTO
.
a
ñ
adirCuenta
(
ControllerLinkBuilder
.
linkTo
(
ControllerLinkBuilder
.
methodOn
(
ServicioRestAPI
.
class
).
detalleCuenta
(
cliente
.
getDni
(),
cuenta
,
cliente
.
getClave
())).
withSelfRel
());
clienteDTO
.
a
ñ
adirCuenta
(
ControllerLinkBuilder
.
linkTo
(
ControllerLinkBuilder
.
methodOn
(
ServicioRestAPI
.
class
).
detalleCuenta
(
cliente
.
getDni
(),
cuenta
,
cliente
.
getClave
())).
withSelfRel
());
}
for
(
Tarjeta
tarjeta
:
cliente
.
getTarjetasAsociadas
().
values
())
{
clienteDTO
.
a
ñ
adirCuenta
(
ControllerLinkBuilder
.
linkTo
(
ControllerLinkBuilder
.
methodOn
(
ServicioRestAPI
.
class
).
detalleTarjeta
(
cliente
.
getDni
(),
tarjeta
.
getIdentificador
(),
cliente
.
getClave
())).
withSelfRel
());
clienteDTO
.
a
ñ
adirCuenta
(
ControllerLinkBuilder
.
linkTo
(
ControllerLinkBuilder
.
methodOn
(
ServicioRestAPI
.
class
).
detalleTarjeta
(
cliente
.
getDni
(),
tarjeta
.
getIdentificador
(),
cliente
.
getClave
())).
withSelfRel
());
}
return
clienteDTO
;
...
...
src/main/java/es/ujaen/dae/ujacoin/beans/ServicioRestAPI.java
View file @
9936b8a3
...
...
@@ -59,7 +59,7 @@ public class ServicioRestAPI {
}
@GetMapping
(
"/
ujacoin/
clientes/{dni}/cuentas/{num}}"
)
@GetMapping
(
"/clientes/{dni}/cuentas/{num}}"
)
public
ResponseEntity
<
CuentaDTO
>
detalleCuenta
(
@PathVariable
String
dni
,
@PathVariable
String
num
,
@RequestParam
(
defaultValue
=
""
)
String
pass
)
{
if
(
dni
!=
null
&&
""
.
equals
(
dni
)
&&
num
!=
null
&&
""
.
equals
(
num
)
&&
pass
!=
null
&&
""
.
equals
(
pass
))
{
...
...
@@ -90,7 +90,7 @@ public class ServicioRestAPI {
}
@GetMapping
(
"/
ujacoin/
clientes/{dni}/tarjetas/{num}}"
)
@GetMapping
(
"/clientes/{dni}/tarjetas/{num}}"
)
public
ResponseEntity
<
TarjetaDTO
>
detalleTarjeta
(
@PathVariable
String
dni
,
@PathVariable
int
num
,
@RequestParam
(
defaultValue
=
""
)
String
pass
)
{
if
(
dni
!=
null
&&
""
.
equals
(
dni
)
&&
pass
!=
null
&&
""
.
equals
(
pass
))
{
...
...
src/main/java/es/ujaen/dae/ujacoin/entidadesDTO/ClienteDTO.java
View file @
9936b8a3
...
...
@@ -31,14 +31,13 @@ public class ClienteDTO {
public
ClienteDTO
()
{
}
public
ClienteDTO
(
String
dni
,
String
nombre
,
LocalDate
fechaNacimiento
,
String
direccion
,
String
telefono
,
String
email
,
String
clave
)
{
public
ClienteDTO
(
String
dni
,
String
nombre
,
LocalDate
fechaNacimiento
,
String
direccion
,
String
telefono
,
String
email
)
{
this
.
dni
=
dni
;
this
.
nombre
=
nombre
;
this
.
fechaNacimiento
=
fechaNacimiento
;
this
.
direccion
=
direccion
;
this
.
telefono
=
telefono
;
this
.
email
=
email
;
this
.
clave
=
clave
;
this
.
cuentasAsociadas
=
new
ArrayList
<>();
this
.
tarjetasAsociadas
=
new
ArrayList
<>();
}
...
...
src/main/java/es/ujaen/dae/ujacoin/entidadesDTO/MovimientoDTO.java
View file @
9936b8a3
...
...
@@ -15,7 +15,6 @@ import java.time.LocalDateTime;
*/
public
class
MovimientoDTO
{
private
int
identificador
;
private
TipoMovimiento
tipo
;
private
float
importe
;
private
LocalDateTime
fechaHora
;
...
...
@@ -25,14 +24,6 @@ public class MovimientoDTO {
public
MovimientoDTO
()
{
}
public
MovimientoDTO
(
int
identificador
,
TipoMovimiento
tipo
,
float
importe
,
LocalDateTime
fechaHora
,
String
tarjetaCuenta
)
{
this
.
identificador
=
identificador
;
this
.
tipo
=
tipo
;
this
.
importe
=
importe
;
this
.
fechaHora
=
fechaHora
;
this
.
tarjetaCuenta
=
tarjetaCuenta
;
}
public
MovimientoDTO
(
TipoMovimiento
tipo
,
float
importe
,
LocalDateTime
fechaHora
,
String
tarjetaCuenta
)
{
this
.
tipo
=
tipo
;
this
.
importe
=
importe
;
...
...
@@ -51,10 +42,6 @@ public class MovimientoDTO {
return
tarjetaCuenta
;
}
public
int
getIdentificador
()
{
return
identificador
;
}
public
LocalDateTime
getFechaHora
()
{
return
fechaHora
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment