From c1424969219f0bd2063bb9f91ac2c17541085777 Mon Sep 17 00:00:00 2001 From: Giuli1297 Date: Wed, 24 Nov 2021 11:41:53 -0300 Subject: [PATCH] Cambio de filtro de seleccion de experiencia --- curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java | 29 +++++++++++++++++++---------- curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java | 4 ++-- curriculumsearch/src/main/webapp/jsp/postulantes.jsp | 9 +++++---- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java index b5b4a3c..7164e2b 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java @@ -4,12 +4,7 @@ package com.roshka.controller; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; - -import java.util.Date; -import java.util.HashMap; - -import java.util.List; +import java.util.*; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -93,7 +88,7 @@ public class PostulanteRRHHController { @RequestParam(required = false)Long lvlEng, @RequestParam(required = false)Long lvlTec, @RequestParam(required = false)Long instId, - @RequestParam(required = false)Long expInMonths, + @RequestParam(required = false)String expInMonths, @RequestParam(required = false)Long cargoId, @RequestParam(required = false)Long convId, @RequestParam(defaultValue = "0")Integer nroPagina @@ -114,11 +109,18 @@ public class PostulanteRRHHController { // TODO Auto-generated catch block er.printStackTrace(); } + long infRange = 0L; + long supRange = 1200L; + if(expInMonths != null && !expInMonths.trim().isEmpty()){ + String[] rango = expInMonths.split("-"); + infRange = Long.parseLong(rango[0]); + supRange = Long.parseLong(rango[1]); + } Page postulantesPag = post.postulantesMultiFiltro( nombre == null || nombre.trim().isEmpty() ? new TypedParameterValue(StringType.INSTANCE,null) : new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"), - lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId, expInMonths); + lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId, infRange, supRange); model.addAttribute("numeroOcurrencias", postulantesPag.getTotalElements()); List postulantes = postulantesPag.getContent(); List postulantesDTO = new ArrayList<>(); @@ -148,17 +150,24 @@ public class PostulanteRRHHController { @RequestParam(required = false)Long lvlEng, @RequestParam(required = false)Long lvlTec, @RequestParam(required = false)Long instId, - @RequestParam(required = false)Long expInMonths, + @RequestParam(required = false)String expInMonths, @RequestParam(required = false)Long cargoId, @RequestParam(required = false)Long convId, @RequestParam(defaultValue = "0")Integer nroPagina ) throws IOException { Pageable page = PageRequest.of(0,Integer.MAX_VALUE,Sort.by("id")); + long infRange = 0L; + long supRange = 1200L; + if(expInMonths != null && !expInMonths.trim().isEmpty()){ + String[] rango = expInMonths.split("-"); + infRange = Long.parseLong(rango[0]); + supRange = Long.parseLong(rango[1]); + } Page postulantesPag = post.postulantesMultiFiltro( nombre == null || nombre.trim().isEmpty() ? new TypedParameterValue(StringType.INSTANCE,null) : new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"), - lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId, expInMonths); + lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId, infRange, supRange); List postulantes = postulantesPag.getContent(); List postulantesDTO = new ArrayList<>(); diff --git a/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java b/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java index 458b285..72ec7c9 100644 --- a/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java +++ b/curriculumsearch/src/main/java/com/roshka/repositorio/PostulanteRepository.java @@ -61,10 +61,10 @@ public interface PostulanteRepository extends JpaRepository { " and (conv.cargoId = ?6 or ?6 is null ) "+ "and (p.estadoPostulante = ?7 or ?7 is null) "+ " and (conv.id=?8 or ?8 is null ) " + - "and (p.mesesDeExperiencia >= ?9 or ?9 is null ) ") + "and (p.mesesDeExperiencia >= ?9 and p.mesesDeExperiencia <= ?10 ) ") public Page postulantesMultiFiltro(TypedParameterValue nombre, Long nivelInges, Long nivel, Long tecnoId, Long instId,Long cargoId, Pageable pageable, EstadoPostulante estado, - Long convo, Long expInMonths); + Long convo, Long infRangeExp, Long supRangeExp); @Transactional @Modifying diff --git a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp index cbdedb7..689b5f1 100644 --- a/curriculumsearch/src/main/webapp/jsp/postulantes.jsp +++ b/curriculumsearch/src/main/webapp/jsp/postulantes.jsp @@ -78,10 +78,11 @@ -- libgit2 0.26.0