Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
th-app-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amparo Oliver
th-app-java
Commits
4aa3516c
Commit
4aa3516c
authored
Nov 11, 2021
by
Joel Florentin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'giuli_001' of
https://phoebe.roshka.com/gitlab/hshah/TalentoHumano
into joel-001
parents
888607b2
b2a47f91
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
148 additions
and
24 deletions
+148
-24
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
+17
-4
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
+1
-0
curriculumsearch/src/main/java/com/roshka/modelo/ReferenciaPersonal.java
+2
-9
curriculumsearch/src/main/java/com/roshka/repositorio/EstudioRepository.java
+4
-0
curriculumsearch/src/main/java/com/roshka/repositorio/ExperienciaRepository.java
+3
-0
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java
+2
-0
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteTecnologiaRepository.java
+4
-1
curriculumsearch/src/main/resources/static/main.js
+115
-10
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
+0
-0
No files found.
curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java
View file @
4aa3516c
...
...
@@ -55,6 +55,8 @@ public class PostulanteController {
InstitucionRepository
institucionRepository
;
DepartamentoRepository
depRepo
;
CiudadRepository
ciuRepo
;
EstudioRepository
estudioRepository
;
PostulanteTecnologiaRepository
postulanteTecnologiaRepository
;
ConvocatoriaRepository
cargoRepo
;
CargoRepository
carRepo
;
...
...
@@ -62,13 +64,17 @@ public class PostulanteController {
public
PostulanteController
(
PostulanteRepository
post
,
TecnologiaRepository
tecRepo
,
ExperienciaRepository
expRepo
,
InstitucionRepository
institucionRepository
,
DepartamentoRepository
depRepo
,
CiudadRepository
ciuRepo
,
ConvocatoriaRepository
cargoRepo
,
CargoRepository
carRepo
)
{
CiudadRepository
ciuRepo
,
EstudioRepository
estudioRepository
,
PostulanteTecnologiaRepository
postulanteTecnologiaRepository
,
ConvocatoriaRepository
cargoRepo
,
CargoRepository
carRepo
)
{
this
.
post
=
post
;
this
.
tecRepo
=
tecRepo
;
this
.
expRepo
=
expRepo
;
this
.
institucionRepository
=
institucionRepository
;
this
.
depRepo
=
depRepo
;
this
.
ciuRepo
=
ciuRepo
;
this
.
estudioRepository
=
estudioRepository
;
this
.
postulanteTecnologiaRepository
=
postulanteTecnologiaRepository
;
this
.
cargoRepo
=
cargoRepo
;
this
.
carRepo
=
carRepo
;
}
...
...
@@ -140,17 +146,24 @@ public class PostulanteController {
@PostMapping
(
value
=
"/postulante"
,
consumes
=
"application/json"
)
public
String
guardarPostulante
(
@RequestBody
Postulante
postulante
){
//Codigo encargado de modificar postulacion si se envia mismo CI
Postulante
postulantex
=
post
.
findByNroDocument
(
postulante
.
getnroDocument
());
if
(
postulantex
!=
null
){
estudioRepository
.
findByPostulante
(
postulantex
).
forEach
(
x
->
estudioRepository
.
delete
(
x
));
expRepo
.
findByPostulante
(
postulantex
).
forEach
(
x
->
expRepo
.
delete
(
x
));
postulanteTecnologiaRepository
.
findByPostulante
(
postulantex
).
forEach
(
x
->
postulanteTecnologiaRepository
.
delete
(
x
));
postulante
.
setId
(
postulantex
.
getId
());
}
postulante
.
getTecnologias
().
stream
().
filter
(
tec
->
tec
.
getTecnologia
().
getId
()
!=
0
).
forEach
(
tec
->
tec
.
setTecnologia
(
tecRepo
.
getById
(
tec
.
getTecnologia
().
getId
()))
);
);
/* for (int i = 0; i < postulante.getPostulaciones().size(); i++) {
postulante.getPostulaciones().set(i, cargoRepo.getById(postulante.getPostulaciones().get(i).getId()));
}
*/
for
(
Estudio
estudio:
postulante
.
getEstudios
()){
String
nombreIns
=
""
;
nombreIns
=
estudio
.
getInstitucion
().
getNombre
().
toLowerCase
();
...
...
curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java
View file @
4aa3516c
...
...
@@ -33,6 +33,7 @@ public class PostulanteTecnologia {
@JoinColumn
private
Tecnologia
tecnologia
;
@ManyToOne
()
@JoinColumn
@JsonBackReference
(
value
=
"postulantetecnologia-postulante"
)
...
...
curriculumsearch/src/main/java/com/roshka/modelo/ReferenciaPersonal.java
View file @
4aa3516c
package
com
.
roshka
.
modelo
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
com.fasterxml.jackson.annotation.JsonBackReference
;
...
...
@@ -31,7 +24,7 @@ public class ReferenciaPersonal {
@Column
(
name
=
"relacion"
)
private
String
relacion
;
@ManyToOne
(
optional
=
false
)
@ManyToOne
(
cascade
=
CascadeType
.
ALL
,
optional
=
false
)
@JoinColumn
@JsonBackReference
private
Postulante
postulante
;
...
...
curriculumsearch/src/main/java/com/roshka/repositorio/EstudioRepository.java
View file @
4aa3516c
package
com
.
roshka
.
repositorio
;
import
com.roshka.modelo.Postulante
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
com.roshka.modelo.Estudio
;
import
java.util.List
;
public
interface
EstudioRepository
extends
JpaRepository
<
Estudio
,
Long
>{
public
List
<
Estudio
>
findByPostulante
(
Postulante
postulante
);
}
curriculumsearch/src/main/java/com/roshka/repositorio/ExperienciaRepository.java
View file @
4aa3516c
package
com
.
roshka
.
repositorio
;
import
com.roshka.modelo.Postulante
;
import
org.springframework.data.jpa.repository.JpaRepository
;
...
...
@@ -9,4 +10,6 @@ import com.roshka.modelo.Experiencia;
public
interface
ExperienciaRepository
extends
JpaRepository
<
Experiencia
,
Long
>
{
public
List
<
Experiencia
>
findByCargoLike
(
String
cargo
);
public
List
<
Experiencia
>
findByPostulante
(
Postulante
postulante
);
}
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java
View file @
4aa3516c
...
...
@@ -14,6 +14,8 @@ import com.roshka.modelo.Postulante;
public
interface
PostulanteRepository
extends
JpaRepository
<
Postulante
,
Long
>
{
public
Postulante
findByNroDocument
(
String
ci
);
@Query
(
"select p from Postulante p join p.estudios e on e.institucion.nombre LIKE %?1%"
)
public
List
<
Postulante
>
findByInstitucionEstudio
(
String
institucion
);
...
...
curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteTecnologiaRepository.java
View file @
4aa3516c
package
com
.
roshka
.
repositorio
;
import
com.roshka.modelo.Postulante
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
com.roshka.modelo.PostulanteTecnologia
;
public
interface
PostulanteTecnologiaRepository
extends
JpaRepository
<
PostulanteTecnologia
,
Long
>{
import
java.util.List
;
public
interface
PostulanteTecnologiaRepository
extends
JpaRepository
<
PostulanteTecnologia
,
Long
>{
public
List
<
PostulanteTecnologia
>
findByPostulante
(
Postulante
postulante
);
}
curriculumsearch/src/main/resources/static/main.js
View file @
4aa3516c
var
cont_experiencia
=
0
;
let
cont_estudios
=
0
;
let
cont_tecnologia
=
0
;
let
cont_cargo
=
0
;
const
experiencias
=
[];
const
estudios
=
[];
const
tecnologias
=
[];
let
noValidateFlag
=
false
;
const
postulaciones
=
[];
var
cont_referencias
=
0
;
const
referencias
=
[];
const
formValidator
=
function
()
{
'use strict'
...
...
@@ -22,6 +30,7 @@ const formValidator = function () {
if
(
!
form
.
checkValidity
())
{
event
.
preventDefault
()
event
.
stopPropagation
()
noValidateFlag
=
true
;
}
form
.
classList
.
add
(
'was-validated'
)
...
...
@@ -194,6 +203,8 @@ function serializeJSON (form) {
pairs
[
"estudios"
]
=
estudios
.
filter
(
est
=>
est
)
//eliminacion de nulos
pairs
[
"tecnologias"
]
=
tecnologias
.
filter
(
tec
=>
tec
)
//eliminacion de nulos
pairs
[
"postulaciones"
]
=
postulaciones
.
filter
(
car
=>
car
)
//eliminacion de nulos
pairs
[
"referencias"
]
=
referencias
.
filter
(
tec
=>
tec
)
// Return the JSON string
return
JSON
.
stringify
(
pairs
,
null
,
2
);
...
...
@@ -228,15 +239,18 @@ form.addEventListener("submit",(evt)=>{
// evt.stopPropagation()
// }
// form.classList.add('was-validated')
postData
(
'postulante'
,
serializeJSON
(
form
))
.
then
(
response
=>
{
if
(
response
.
status
==
200
||
response
.
status
==
302
){
location
.
replace
(
response
.
url
);
}
else
{
console
.
log
(
response
.
text
().
then
(
value
=>
console
.
log
(
value
)))
}
});
evt
.
preventDefault
();
if
(
!
noValidateFlag
){
postData
(
'postulante'
,
serializeJSON
(
form
))
.
then
(
response
=>
{
if
(
response
.
status
==
200
||
response
.
status
==
302
){
location
.
replace
(
response
.
url
);
}
else
{
console
.
log
(
response
.
text
().
then
(
value
=>
console
.
log
(
value
)))
}
});
evt
.
preventDefault
();
}
noValidateFlag
=
false
}
);
document
.
querySelector
(
"#btn-new-tech"
).
addEventListener
(
'click'
,()
=>
{
document
.
querySelector
(
"#tecnologia-nombre"
).
classList
.
remove
(
'd-none'
)})
...
...
@@ -321,6 +335,10 @@ function agregarFieldEstudio(){
}
function
eliminarEstudio
(
event
)
{
//eliminar del array
estudios
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
...
...
@@ -361,6 +379,15 @@ function agregarFieldCargo(){
pairs
[
name
]
=
value
}
console
.
log
(
pairs
)
for
(
let
i
=
0
;
i
<
cont_cargo
;
i
++
){
if
(
postulaciones
[
i
]
!==
null
){
if
(
postulaciones
[
i
][
"id"
]
===
pairs
[
"cargo-id"
]){
alert
(
"Ya has agregado ese cargo!"
)
cont_cargo
--
;
return
;
}
}
}
postulaciones
[
cont_cargo
]
=
{}
postulaciones
[
cont_cargo
][
"id"
]
=
pairs
[
"cargo-id"
]
//postulaciones[cont_cargo]["cargo"]=pairs["cargo-id"]=="-1"?{nombre: pairs["cargo-nombre"]}:{id: pairs["cargo-id"],nombre:document.querySelector('[name=cargo-id] > option[value="'+pairs["cargo-id"]+'"]').innerHTML}
...
...
@@ -369,7 +396,6 @@ function agregarFieldCargo(){
//imprimir lista actualizada
const
div
=
document
.
querySelector
(
"#cargos"
)
const
div1
=
document
.
createElement
(
'div'
);
console
.
log
(
postulaciones
[
0
])
let
content1
=
'<ul>'
for
(
let
index
=
0
;
index
<
postulaciones
.
length
;
index
++
)
{
...
...
@@ -424,3 +450,82 @@ function listarCiudades(depId){
}
function
agregarFieldReferencia
(
event
){
//recoger del form
const
pairs
=
{};
const
formexp
=
document
.
querySelector
(
"[name=referencia-form]"
);
const
formData
=
new
FormData
(
formexp
);
const
referenciaPersonal
=
[{},{},{}];
let
pos_rec
;
let
returnFlag
=
false
;
let
requiredValues
=
[
"nombre"
,
"relacion"
,
"telefono"
]
formData
.
forEach
((
value
,
key
)
=>
{
if
(
requiredValues
.
includes
(
key
)
&&
value
===
""
&&
returnFlag
==
false
){
console
.
log
(
key
,
value
)
returnFlag
=
true
;
}
});
if
(
returnFlag
===
true
){
let
message
=
"Rellene "
for
(
let
i
=
0
;
i
<
requiredValues
.
length
;
i
++
){
message
+=
", "
+
requiredValues
[
i
];
}
message
+=
" como minimo."
alert
(
message
);
return
;
}
for
(
const
[
name
,
value
]
of
formData
){
pos_rec
=
name
.
split
(
"-"
);
//rec-nombre-index
if
(
pos_rec
.
length
>
1
)
{
referenciaPersonal
[
pos_rec
[
2
]][
pos_rec
[
1
]]
=
value
}
else
{
pairs
[
name
]
=
value
}
}
pairs
[
"referenciaPersonal"
]
=
referenciaPersonal
.
filter
(
rec
=>
rec
.
nombre
);
referencias
[
cont_referencias
]
=
pairs
;
formexp
.
reset
();
//imprimir lista actualizada
const
div
=
document
.
querySelector
(
"#referencia"
)
const
div1
=
document
.
createElement
(
'div'
);
let
content
=
'<ul>'
for
(
let
index
=
0
;
index
<
referencias
.
length
;
index
++
)
{
const
exp
=
referencias
[
index
];
if
(
exp
==
null
)
continue
;
content
+=
`
<li id="exp-
${
index
}
">
${
exp
.
nombre
}
<button type="button" onclick="eliminarReferencia(event)"> <span class="glyphicon glyphicon-trash"></span> Tras</button>
</li>
`
}
content
+=
"</ul>"
div1
.
innerHTML
=
content
div
.
innerHTML
=
''
;
div
.
appendChild
(
div1
);
cont_referencias
++
;
}
/*----------------------------------------------------------------- */
function
eliminarReferencia
(
event
)
{
//eliminar del array
referencias
[
event
.
target
.
parentElement
.
id
.
split
(
"-"
)[
1
]]
=
null
//eliminar en html
event
.
target
.
parentElement
.
remove
()
}
/*----------------------------------------------------------------- */
curriculumsearch/src/main/webapp/jsp/postulante-form.jsp
View file @
4aa3516c
This diff is collapsed.
Click to expand it.
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