Commit 874ea5af by Joel Florentin

Merge branch 'giuli_001' of https://phoebe.roshka.com/gitlab/hshah/TalentoHumano into joel-001

parents fd81e613 e6f2073b
...@@ -98,6 +98,7 @@ public class PostulanteRRHHController { ...@@ -98,6 +98,7 @@ public class PostulanteRRHHController {
@RequestParam(required = false)Long convId, @RequestParam(required = false)Long convId,
@RequestParam(defaultValue = "0")Integer nroPagina @RequestParam(defaultValue = "0")Integer nroPagina
) throws IOException { ) throws IOException {
final Integer CANTIDAD_POR_PAGINA = 10; final Integer CANTIDAD_POR_PAGINA = 10;
Pageable page = PageRequest.of(nroPagina,CANTIDAD_POR_PAGINA,Sort.by("id")); Pageable page = PageRequest.of(nroPagina,CANTIDAD_POR_PAGINA,Sort.by("id"));
model.addAttribute("tecnologias", tecRepo.findAll()); model.addAttribute("tecnologias", tecRepo.findAll());
...@@ -117,20 +118,16 @@ public class PostulanteRRHHController { ...@@ -117,20 +118,16 @@ public class PostulanteRRHHController {
nombre == null || nombre.trim().isEmpty() ? nombre == null || nombre.trim().isEmpty() ?
new TypedParameterValue(StringType.INSTANCE,null) : new TypedParameterValue(StringType.INSTANCE,null) :
new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"), new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"),
lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId); lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId, expInMonths);
model.addAttribute("numeroOcurrencias", postulantesPag.getTotalElements()); model.addAttribute("numeroOcurrencias", postulantesPag.getTotalElements());
List<Postulante> postulantes = postulantesPag.getContent(); List<Postulante> postulantes = postulantesPag.getContent();
List<PostulanteListaDTO> postulantesDTO = new ArrayList<>(); List<PostulanteListaDTO> postulantesDTO = new ArrayList<>();
for (Postulante postulante : postulantes) { for (Postulante postulante : postulantes) {
long expTotal = 0; postulantesDTO.add(new PostulanteListaDTO(postulante.getId(), postulante.getNombre(),
//Sumamos el tiempo de experiencia total en meses de cada postulante postulante.getApellido(), postulante.getNivelIngles(),
//expTotal = postulante.getExperiencias().stream().mapToLong(e -> Helper.getMonthsDifference(e.getFechaDesde(), e.getFechaHasta())).sum(); postulante.getMesesDeExperiencia(), postulante.getTecnologias(),postulante.getEstadoPostulante(),
for (Experiencia experiencia : postulante.getExperiencias()) { postulante.getPostulaciones()));
expTotal += Helper.getMonthsDifference(experiencia.getFechaDesde(), experiencia.getFechaHasta());
}
if(expInMonths != null && expInMonths > expTotal) continue;
postulantesDTO.add(new PostulanteListaDTO(postulante.getId(), postulante.getNombre(), postulante.getApellido(), postulante.getNivelIngles(), expTotal, postulante.getTecnologias(),postulante.getEstadoPostulante(),postulante.getPostulaciones()));
} }
model.addAttribute("pages", postulantesPag.getTotalPages()); model.addAttribute("pages", postulantesPag.getTotalPages());
...@@ -161,19 +158,15 @@ public class PostulanteRRHHController { ...@@ -161,19 +158,15 @@ public class PostulanteRRHHController {
nombre == null || nombre.trim().isEmpty() ? nombre == null || nombre.trim().isEmpty() ?
new TypedParameterValue(StringType.INSTANCE,null) : new TypedParameterValue(StringType.INSTANCE,null) :
new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"), new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"),
lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId); lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId, expInMonths);
List<Postulante> postulantes = postulantesPag.getContent(); List<Postulante> postulantes = postulantesPag.getContent();
List<PostulanteListaDTO> postulantesDTO = new ArrayList<>(); List<PostulanteListaDTO> postulantesDTO = new ArrayList<>();
for (Postulante postulante : postulantes) { for (Postulante postulante : postulantes) {
long expTotal = 0; postulantesDTO.add(new PostulanteListaDTO(postulante.getId(), postulante.getNombre(),
//Sumamos el tiempo de experiencia total en meses de cada postulante postulante.getApellido(), postulante.getNivelIngles(),
//expTotal = postulante.getExperiencias().stream().mapToLong(e -> Helper.getMonthsDifference(e.getFechaDesde(), e.getFechaHasta())).sum(); postulante.getMesesDeExperiencia(), postulante.getTecnologias(),postulante.getEstadoPostulante(),
for (Experiencia experiencia : postulante.getExperiencias()) { postulante.getPostulaciones()));
expTotal += Helper.getMonthsDifference(experiencia.getFechaDesde(), experiencia.getFechaHasta());
}
if(expInMonths != null && expInMonths > expTotal) continue;
postulantesDTO.add(new PostulanteListaDTO(postulante.getId(), postulante.getNombre(), postulante.getApellido(), postulante.getNivelIngles(), expTotal, postulante.getTecnologias(),postulante.getEstadoPostulante(),postulante.getPostulaciones()));
} }
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
......
...@@ -133,11 +133,16 @@ public class Postulante { ...@@ -133,11 +133,16 @@ public class Postulante {
@Column(name = "fecha_contratado") @Column(name = "fecha_contratado")
private Date fechaContratado; private Date fechaContratado;
@Column(name = "meses_de_exp")
private Long mesesDeExperiencia;
public void setFechaNacimiento(String fechaNacimiento) { public void setFechaNacimiento(String fechaNacimiento) {
this.fechaNacimiento = Helper.convertirFecha(fechaNacimiento); this.fechaNacimiento = Helper.convertirFecha(fechaNacimiento);
} }
@PrePersist @PrePersist
public void precargarFechas(){ public void precargarFechas(){
this.fechaCreacion = new Date(); this.fechaCreacion = new Date();
...@@ -145,6 +150,17 @@ public class Postulante { ...@@ -145,6 +150,17 @@ public class Postulante {
this.estadoPostulante = EstadoPostulante.NUEVO; this.estadoPostulante = EstadoPostulante.NUEVO;
this.comentarioRRHH = null; this.comentarioRRHH = null;
} }
@PostPersist
private void calcularExperienciaEnMese(){
long expTotal = 0;
//expTotal = postulante.getExperiencias().stream().mapToLong(e -> Helper.getMonthsDifference(e.getFechaDesde(), e.getFechaHasta())).sum();
for (Experiencia experiencia : this.experiencias) {
expTotal += Helper.getMonthsDifference(experiencia.getFechaDesde(), experiencia.getFechaHasta());
}
this.mesesDeExperiencia = expTotal;
}
@PreUpdate @PreUpdate
public void actualizarFecha(){ public void actualizarFecha(){
this.fechaActualizacion= new Date(); this.fechaActualizacion= new Date();
......
...@@ -54,15 +54,17 @@ public interface PostulanteRepository extends JpaRepository<Postulante,Long> { ...@@ -54,15 +54,17 @@ public interface PostulanteRepository extends JpaRepository<Postulante,Long> {
"left join p.tecnologias pt " + "left join p.tecnologias pt " +
"left join p.postulaciones conv " + "left join p.postulaciones conv " +
"where (?1 is null or lower(p.nombre) LIKE lower(?1) or lower(p.apellido) LIKE lower(?1) ) " + "where (?1 is null or lower(p.nombre) LIKE lower(?1) or lower(p.apellido) LIKE lower(?1) ) " +
"and (p.nivelIngles >= ?2 or ?2 is null) "+ "and (p.nivelIngles >= ?2 or ?2 is null) "+
"and (pt.nivel >= ?3 or ?3 is null) "+ "and (pt.nivel >= ?3 or ?3 is null) "+
"and (pt.tecnologia.id = ?4 or ?4 is null) "+ "and (pt.tecnologia.id = ?4 or ?4 is null) "+
" and (e.institucion.id = ?5 or ?5 is null ) "+ " and (e.institucion.id = ?5 or ?5 is null ) "+
" and (conv.cargoId = ?6 or ?6 is null ) "+ " and (conv.cargoId = ?6 or ?6 is null ) "+
"and (p.estadoPostulante = ?7 or ?7 is null) "+ "and (p.estadoPostulante = ?7 or ?7 is null) "+
" and (conv.id=?8 or ?8 is null ) ") " and (conv.id=?8 or ?8 is null ) " +
public Page<Postulante> postulantesMultiFiltro(TypedParameterValue nombre, Long nivelInges, Long nivel, Long tecnoId, Long instId,Long cargoId, Pageable pageable, EstadoPostulante estado, Long convo); "and (p.mesesDeExperiencia >= ?9 or ?9 is null ) ")
public Page<Postulante> postulantesMultiFiltro(TypedParameterValue nombre, Long nivelInges, Long nivel, Long tecnoId,
Long instId,Long cargoId, Pageable pageable, EstadoPostulante estado,
Long convo, Long expInMonths);
@Transactional @Transactional
@Modifying @Modifying
......
...@@ -14,9 +14,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -14,9 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import com.roshka.DTO.PostulanteListaDTO; import com.roshka.DTO.PostulanteListaDTO;
import com.roshka.modelo.PostulanteTecnologia; import com.roshka.modelo.PostulanteTecnologia;
import com.roshka.modelo.Tecnologia; import com.roshka.modelo.Tecnologia;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
...@@ -42,9 +40,16 @@ public class PostulantesExcelExporter { ...@@ -42,9 +40,16 @@ public class PostulantesExcelExporter {
Row row = sheet.createRow(0); Row row = sheet.createRow(0);
CellStyle style = workbook.createCellStyle(); CellStyle style = workbook.createCellStyle();
XSSFFont font = workbook.createFont(); XSSFFont font = workbook.createFont();
font.setFontHeightInPoints((short)14);
font.setColor(IndexedColors.WHITE.getIndex());
font.setBold(true); font.setBold(true);
font.setFontHeight(14); font.setItalic(false);
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
style.setAlignment(HorizontalAlignment.CENTER);
// Setting font to style
style.setFont(font); style.setFont(font);
createCell(row, 0, "Postulantes "+currentDateTime, style); createCell(row, 0, "Postulantes "+currentDateTime, style);
row = sheet.createRow(2); row = sheet.createRow(2);
......
...@@ -122,24 +122,34 @@ ...@@ -122,24 +122,34 @@
</div> </div>
</div> </div>
<hr> <hr>
<div class="row" id="buttonRow" style="display: block"> <div id="buttonRow" style="display: block">
<div class="col"> <div class="row">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#estadoModalLong">Agregar observacion</button> <div class="col-4">
<button id="pdf" type="button" class="btn btn-primary">PDF</button> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#estadoModalLong">Agregar observacion</button>
</div> </div>
<c:choose> <div class="col-4">
<div class="dropdown">
<c:when test = "${cvId != null}"> <button class="dropdown-toggle btn btn-light" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<div class="col"> PDF
<a class="btn btn-link" target="__blank" href="/postulantes/cvFile/${cvId}">Descargar CV</a> </button>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a id="pdf" type="button" class="dropdown-item">Imagen</a></li>
<li><a class="dropdown-item" target="__blank" href="/postulantes/${postulante.id}/pdf">Info</a></li>
</ul>
</div> </div>
</c:when> </div>
<c:choose>
</c:choose> <c:when test = "${cvId != null}">
<div class="col"> <div class="col-4">
<a class="btn btn-link" target="__blank" href="/postulantes/${postulante.id}/pdf">Obtener pdf</a> <a class="btn btn-link" target="__blank" href="/postulantes/cvFile/${cvId}">Descargar CV</a>
</div> </div>
</c:when>
</c:choose>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -391,7 +401,7 @@ ...@@ -391,7 +401,7 @@
var carousels = document.querySelectorAll(".pdf-carousel"); var carousels = document.querySelectorAll(".pdf-carousel");
var hrs = document.querySelectorAll(".lineas-pdf"); var hrs = document.querySelectorAll(".lineas-pdf");
var opt = { var opt = {
margin: 1, margin: [1, 1, 1, 1],
filename: 'myfile.pdf', filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 }, image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 }, html2canvas: { scale: 2 },
...@@ -405,7 +415,6 @@ ...@@ -405,7 +415,6 @@
element.style.display = "block" element.style.display = "block"
}); });
await html2pdf().set(opt).from(element).toPdf().save(); await html2pdf().set(opt).from(element).toPdf().save();
console.log('xd');
buttonsRow.style.display = "block"; buttonsRow.style.display = "block";
carousels.forEach((element)=>{ carousels.forEach((element)=>{
element.classList.add('carousel-item') element.classList.add('carousel-item')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment