diff --git a/curriculumsearch/pom.xml b/curriculumsearch/pom.xml index 4575652..bd97b04 100644 --- a/curriculumsearch/pom.xml +++ b/curriculumsearch/pom.xml @@ -92,6 +92,21 @@ compile + + + + org.apache.poi + poi-ooxml + 4.1.0 + + + + com.itextpdf + itextpdf + 5.5.13 + + + diff --git a/curriculumsearch/src/main/java/com/roshka/CurriculumsearchApplication.java b/curriculumsearch/src/main/java/com/roshka/CurriculumsearchApplication.java index 173a835..ef85ce3 100644 --- a/curriculumsearch/src/main/java/com/roshka/CurriculumsearchApplication.java +++ b/curriculumsearch/src/main/java/com/roshka/CurriculumsearchApplication.java @@ -42,6 +42,7 @@ public class CurriculumsearchApplication { guardarJson(convR,"/json/convocatoria.json",ConvocatoriaCargo.class); guardarJson(depR,"/json/Departamento.json",Departamento.class); guardarJson(ciudR,"/json/Ciudad.json",Ciudad.class); + guardarJson(tecRepo,"/json/tecnologia.json",Tecnologia.class); guardarJson(postRepo,"/json/postulante.json",Postulante.class); String password = new BCryptPasswordEncoder().encode("test"); diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java index 2e15e7e..5ef4d2b 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteController.java @@ -114,10 +114,7 @@ public class PostulanteController { DBFile cv = Helper.createFile(file); if(cv!=null) cv.setPostulante(postulante); postulante.setCvFile(cv); - } - postulante.getTecnologias().stream().filter(tec -> tec.getTecnologia().getId() != 0) - .forEach(tec -> tec.setTecnologia(tecRepo.getById(tec.getTecnologia().getId()))); - + } for(Estudio estudio: postulante.getEstudios()){ String nombreIns = ""; nombreIns = estudio.getInstitucion().getNombre().toLowerCase(); diff --git a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java index 3e75ebb..20b20ba 100644 --- a/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java +++ b/curriculumsearch/src/main/java/com/roshka/controller/PostulanteRRHHController.java @@ -1,8 +1,14 @@ 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 com.fasterxml.jackson.core.JsonProcessingException; @@ -20,9 +26,11 @@ import com.roshka.repositorio.ExperienciaRepository; import com.roshka.repositorio.InstitucionRepository; import com.roshka.repositorio.PostulanteRepository; import com.roshka.repositorio.TecnologiaRepository; +import com.roshka.service.PdfGenerator; import com.roshka.utils.Helper; +import com.roshka.utils.PostulantesExcelExporter; import org.hibernate.jpa.TypedParameterValue; import org.hibernate.type.StringType; import org.springframework.beans.factory.annotation.Autowired; @@ -40,6 +48,8 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; @Controller @@ -77,7 +87,7 @@ public class PostulanteRRHHController { } @RequestMapping("/postulantes") - public String postulantes(Model model, + public String postulantes(HttpServletRequest request, Model model, @RequestParam(required = false)Long tecId, @RequestParam(required = false)String nombre, @RequestParam(required = false)EstadoPostulante estado, @@ -89,13 +99,14 @@ public class PostulanteRRHHController { @RequestParam(required = false)Long cargoId, @RequestParam(required = false)Long convId, @RequestParam(defaultValue = "0")Integer nroPagina - ) { - final Integer CANTIDAD_POR_PAGINA = 10; + ) throws IOException { + final Integer CANTIDAD_POR_PAGINA = 5; Pageable page = PageRequest.of(nroPagina,CANTIDAD_POR_PAGINA,Sort.by("id")); model.addAttribute("tecnologias", tecRepo.findAll()); model.addAttribute("disponibilidades", Disponibilidad.values()); model.addAttribute("institucionesEducativas", institucionRepository.findAll()); model.addAttribute("estadoP", EstadoPostulante.values()); + model.addAttribute("cargos", carRepo.findAll()); model.addAttribute("cargoRepo", cargoRepo); //model.addAttribute("convocatoriaC", cargoRepo.findAll()); @@ -105,7 +116,12 @@ public class PostulanteRRHHController { // TODO Auto-generated catch block er.printStackTrace(); } - Page postulantesPag = post.postulantesMultiFiltro(nombre == null || nombre.trim().isEmpty() ? new TypedParameterValue(StringType.INSTANCE,null) : new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"),dispo, lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId); + Page postulantesPag = post.postulantesMultiFiltro( + nombre == null || nombre.trim().isEmpty() ? + new TypedParameterValue(StringType.INSTANCE,null) : + new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"), + dispo, lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId); + model.addAttribute("numeroOcurrencias", postulantesPag.getTotalElements()); List postulantes = postulantesPag.getContent(); List postulantesDTO = new ArrayList<>(); @@ -119,12 +135,73 @@ public class PostulanteRRHHController { if(expInMonths != null && expInMonths > expTotal) continue; postulantesDTO.add(new PostulanteListaDTO(postulante.getId(), postulante.getNombre(), postulante.getApellido(), postulante.getDisponibilidad(), postulante.getNivelIngles(), expTotal, postulante.getTecnologias(),postulante.getEstadoPostulante(),postulante.getPostulaciones())); } - + model.addAttribute("pages", postulantesPag.getTotalPages()); model.addAttribute("postulantes", postulantesDTO); + + String query = request.getQueryString(); + model.addAttribute("query", query); + return "postulantes"; } - + + + @RequestMapping("/postulantesExcel") + public void exportPostulantesExcel(HttpServletResponse response, Model model, + @RequestParam(required = false)Long tecId, + @RequestParam(required = false)String nombre, + @RequestParam(required = false)EstadoPostulante estado, + @RequestParam(required = false)Disponibilidad dispo, + @RequestParam(required = false)Long lvlEng, + @RequestParam(required = false)Long lvlTec, + @RequestParam(required = false)Long instId, + @RequestParam(required = false)Long 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")); + Page postulantesPag = post.postulantesMultiFiltro( + nombre == null || nombre.trim().isEmpty() ? + new TypedParameterValue(StringType.INSTANCE,null) : + new TypedParameterValue(StringType.INSTANCE,"%"+nombre+"%"), + dispo, lvlEng, lvlTec, tecId, instId,cargoId,page,estado,convId); + List postulantes = postulantesPag.getContent(); + List postulantesDTO = new ArrayList<>(); + + for (Postulante postulante : postulantes) { + long expTotal = 0; + //Sumamos el tiempo de experiencia total en meses de cada postulante + //expTotal = postulante.getExperiencias().stream().mapToLong(e -> Helper.getMonthsDifference(e.getFechaDesde(), e.getFechaHasta())).sum(); + for (Experiencia experiencia : postulante.getExperiencias()) { + expTotal += Helper.getMonthsDifference(experiencia.getFechaDesde(), experiencia.getFechaHasta()); + } + if(expInMonths != null && expInMonths > expTotal) continue; + postulantesDTO.add(new PostulanteListaDTO(postulante.getId(), postulante.getNombre(), postulante.getApellido(), postulante.getDisponibilidad(), postulante.getNivelIngles(), expTotal, postulante.getTecnologias(),postulante.getEstadoPostulante(),postulante.getPostulaciones())); + } + + response.setContentType("application/octet-stream"); + DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); + String currentDateTime = dateFormatter.format(new Date()); + + String headerKey = "Content-Disposition"; + String headerValue = "attachment; filename=postulantes_" + currentDateTime + ".xlsx"; + response.setHeader(headerKey, headerValue); + + HashMap filtros = new HashMap(); + filtros.put("nombre", nombre.equals("") ? "-":nombre); + filtros.put("nivelIngles", lvlEng == null ? "-" : lvlEng.toString()); + filtros.put("tecnologia", tecId == null ? "-" : tecRepo.findById(tecId).get().getNombre()); + filtros.put("nivelTecnologia", lvlTec == null ? "-" : lvlTec.toString()); + filtros.put("institucion", instId == null ? "-" : institucionRepository.findById(instId).get().getNombre()); + filtros.put("estado", estado == null ? "-" : estado.getEstado()); + filtros.put("experienciaEnMeses", expInMonths == null ? "-" : expInMonths.toString()); + filtros.put("convocatoria", convId == null ? "-" : cargoRepo.findById(convId).get().getCargo().getNombre()); + + PostulantesExcelExporter excelExporter = new PostulantesExcelExporter(postulantesDTO, filtros); + + excelExporter.export(response); + } @GetMapping({"/postulantes/{postulanteId}"}) @@ -136,6 +213,8 @@ public class PostulanteRRHHController { return "detallepostulante"; } + + @PostMapping({"/postulantes/{postulanteId}"}) public String setPostulanteEstado(@ModelAttribute Postulante postulante, BindingResult result, @PathVariable("postulanteId") Long postulanteId) { //post.setPostulanteEstadoAndComentario(postulante.getEstadoPostulante(),postulante.getComentarioRRHH(), postulante.getId()); @@ -169,5 +248,26 @@ public class PostulanteRRHHController { } } + + @GetMapping("/postulantes/{id}/pdf") + public ResponseEntity downloadPDF(@PathVariable Long id) { + // Load file from database + PdfGenerator pdf = new PdfGenerator(); + + + try { + Postulante postulante = post.findById(id) + .orElseThrow(() -> new Exception("Postulante no encontrado")); + return ResponseEntity.ok() + .contentType(MediaType.parseMediaType("application/pdf")) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + postulante.getNroDocument() + ".pdf" + "\"") + .body(new ByteArrayResource(pdf.generatePdfReport(postulante))); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return ResponseEntity.notFound().build(); + } + + } } \ No newline at end of file diff --git a/curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java b/curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java index 7c27b6a..6d037a2 100644 --- a/curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java +++ b/curriculumsearch/src/main/java/com/roshka/modelo/Postulante.java @@ -96,6 +96,9 @@ public class Postulante { @Column(name = "disponibilidad", length = 2) private Disponibilidad disponibilidad; + @Column(name = "tecnologia_otros") + private String tecnologiaOtros; + @JsonManagedReference(value = "postulantetecnologia-postulante") @OneToMany(mappedBy = "postulante",cascade = CascadeType.ALL) private List tecnologias; diff --git a/curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java b/curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java index 4224e07..771a35c 100644 --- a/curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java +++ b/curriculumsearch/src/main/java/com/roshka/modelo/PostulanteTecnologia.java @@ -31,7 +31,7 @@ public class PostulanteTecnologia { @Min(value = 1) @Max(value = 5) private Long nivel; - @ManyToOne(cascade = {CascadeType.PERSIST},optional = false) + @ManyToOne() @JoinColumn private Tecnologia tecnologia; diff --git a/curriculumsearch/src/main/java/com/roshka/service/PdfGenerator.java b/curriculumsearch/src/main/java/com/roshka/service/PdfGenerator.java new file mode 100644 index 0000000..0d75e82 --- /dev/null +++ b/curriculumsearch/src/main/java/com/roshka/service/PdfGenerator.java @@ -0,0 +1,169 @@ +package com.roshka.service; + +import java.io.ByteArrayOutputStream; +import java.util.Date; +import java.util.stream.Collectors; + +import com.itextpdf.text.List; +import com.itextpdf.text.ListItem; + + +import org.springframework.stereotype.Component; + + +import com.itextpdf.text.Document; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Element; +import com.itextpdf.text.Font; +import com.itextpdf.text.Paragraph; +import com.itextpdf.text.pdf.PdfWriter; +import com.roshka.modelo.Estudio; +import com.roshka.modelo.Experiencia; +import com.roshka.modelo.Postulante; +import com.roshka.utils.Helper; + +@Component("pdfGenerator") +public class PdfGenerator { + + private static Font COURIER = new Font(Font.FontFamily.COURIER, 20, Font.BOLD); + private static Font COURIER_MEDIUM = new Font(Font.FontFamily.COURIER, 16, Font.BOLD); + private static Font COURIER_SMALL = new Font(Font.FontFamily.COURIER, 14, Font.UNDERLINE); + + public byte[] generatePdfReport(Postulante postulante) { + + Document document = new Document(); + + try { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + PdfWriter.getInstance(document, byteArrayOutputStream); + document.open(); + + addDocTitle(document, postulante); + createTable(document,postulante); + + + document.close(); + System.out.println("------------------Your PDF Report is ready!-------------------------"); + return byteArrayOutputStream.toByteArray(); + + } catch ( DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + + } + + private void addDocTitle(Document document, Postulante postulante) throws DocumentException { + Paragraph p1 = new Paragraph(); + leaveEmptyLine(p1, 1); + p1.add(new Paragraph("Detalles del postulante", COURIER)); + p1.setAlignment(Element.ALIGN_CENTER); + document.add(p1); + + } + private void agregarEncabezado(Document document, String titulo) throws DocumentException { + + Paragraph p1 = new Paragraph(); + p1.setAlignment(Element.ALIGN_CENTER); + p1.add(new Paragraph(titulo, COURIER_MEDIUM)); + document.add(p1); + + } + private void agregarSubEncabezado(Document document, String titulo) throws DocumentException { + + Paragraph p1 = new Paragraph(); + p1.setAlignment(Element.ALIGN_CENTER); + p1.add(new Paragraph(titulo, COURIER_SMALL)); + document.add(p1); + + } + + private void agregarLabelTexto(Document document, String label, Object texto) throws DocumentException{ + if(texto == null) return; + if(texto instanceof Date) texto = Helper.formatDate((Date)texto, "dd-MM-yyyy"); + Paragraph paragraph = new Paragraph(); + paragraph.add(label + ": "); + paragraph.add(texto.toString()); + document.add(paragraph); + } + + private void createTable(Document document, Postulante postulante) throws DocumentException { + + Paragraph paragraph = new Paragraph(); + leaveEmptyLine(paragraph, 3); + //paragraph.add(); + agregarEncabezado(document, "Datos personales"); + agregarLabelTexto(document, "Nombre", postulante.getNombre() + " " + postulante.getApellido()); + agregarLabelTexto(document, "Nro de Documento", postulante.getNroDocument()); + agregarLabelTexto(document, "Correo", postulante.getCorreo()); + agregarLabelTexto(document, "Direccion", postulante.getDireccion()); + agregarLabelTexto(document, "Ciudad", postulante.getCiudad().getNombre()); + agregarLabelTexto(document, "Telefono", postulante.getTelefono()); + agregarLabelTexto(document, "Edad", Helper.calculateAge(postulante.getFechaNacimiento()) ); + agregarLabelTexto(document, "Nivel de Ingles", postulante.getNivelIngles()); + agregarLabelTexto(document, "Nacionalidad", postulante.getNacionalidad().getDescripcion()); + + agregarEncabezado(document, "Experiencias"); + + for(Experiencia ex : postulante.getExperiencias()){ + agregarSubEncabezado(document, ex.getInstitucion()); + agregarLabelTexto(document, "Fecha Inicio", ex.getFechaDesde()); + agregarLabelTexto(document, "Fecha Fin", ex.getFechaHasta()); + agregarLabelTexto(document, "Cargo", ex.getCargo()); + agregarLabelTexto(document, "Tipo Experiencia", ex.getTipoExperiencia()); + agregarLabelTexto(document, "Descripcion", ex.getDescripcion()); + agregarLabelTexto(document, "Nombre Referencia", ex.getNombreReferencia()); + agregarLabelTexto(document, "Telefono Referencia", ex.getTelefonoReferencia()); + agregarLabelTexto(document, "Motivo Salida", ex.getMotivoSalida()); + } + agregarEncabezado(document, "Estudios"); + + for(Estudio ex : postulante.getEstudios()){ + agregarSubEncabezado(document, ex.getInstitucion().getNombre()); + agregarLabelTexto(document, "Fecha Inicio", ex.getFechaDesde()); + agregarLabelTexto(document, "Fecha Fin", ex.getFechaHasta()); + agregarLabelTexto(document, "Tema de Estudio", ex.getTemaDeEstudio()); + agregarLabelTexto(document, "Tipo de Estudio", ex.getTipoDeEstudio()); + agregarLabelTexto(document, "Descripcion", ex.getEstado().toString()); + } + + agregarEncabezado(document, "Cargo al cual postula"); + + agregarList(postulante.getPostulaciones().stream() + .map(cc -> cc.getCargo().getNombre()) + .collect(Collectors.toList()), document); + + agregarEncabezado(document, "Tecnologias"); + + agregarList(postulante.getTecnologias().stream() + .map(cc -> cc.getTecnologia().getNombre()) + .collect(Collectors.toList()), + document); + + agregarEncabezado(document, "Referencias Personales"); + + agregarList(postulante.getReferencias().stream() + .map(cc -> "Nombre: " + cc.getNombre() + ". Relacion: " + cc.getRelacion() + ". Telefono: " + cc.getTelefono() ) + .collect(Collectors.toList()), + document); + + + } + + private void agregarList(java.util.List items, Document document) throws DocumentException{ + List list = new List(false); + for(String item : items){ + list.add(new ListItem(item)); + } + document.add(list); + + + } + private static void leaveEmptyLine(Paragraph paragraph, int number) { + for (int i = 0; i < number; i++) { + paragraph.add(new Paragraph(" ")); + } + } + +} diff --git a/curriculumsearch/src/main/java/com/roshka/utils/Helper.java b/curriculumsearch/src/main/java/com/roshka/utils/Helper.java index 189aa82..426686e 100644 --- a/curriculumsearch/src/main/java/com/roshka/utils/Helper.java +++ b/curriculumsearch/src/main/java/com/roshka/utils/Helper.java @@ -3,9 +3,9 @@ package com.roshka.utils; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.time.YearMonth; -import java.time.ZoneOffset; -import java.time.temporal.ChronoUnit; +import java.time.LocalDate; +import java.time.Period; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.concurrent.TimeUnit; @@ -46,6 +46,31 @@ public class Helper { return Math.round(diff/30.d) ; } + public static LocalDate convertToLocalDateViaSqlDate(Date dateToConvert) { + return new java.sql.Date(dateToConvert.getTime()).toLocalDate(); + } + + public static int calculateAge(LocalDate birthDate, LocalDate currentDate) { + if ((birthDate != null) && (currentDate != null)) { + return Period.between(birthDate, currentDate).getYears(); + } else { + return 0; + } + } + + public static int calculateAge(Date birthDate) { + LocalDate currentDate = LocalDate.now(); + return calculateAge(convertToLocalDateViaSqlDate(birthDate),currentDate); + } + + public static String formatDate(LocalDate fecha, String format){ + if(fecha == null || format == null) return null; + return fecha.format(DateTimeFormatter.ofPattern(format)); + } + public static String formatDate(Date fecha, String format){ + return formatDate(convertToLocalDateViaSqlDate(fecha), format); + } + public static DBFile createFile(MultipartFile file) { // Normalize file name String fileName = StringUtils.cleanPath(file.getOriginalFilename()); diff --git a/curriculumsearch/src/main/java/com/roshka/utils/PostulantesExcelExporter.java b/curriculumsearch/src/main/java/com/roshka/utils/PostulantesExcelExporter.java new file mode 100644 index 0000000..4fe21e4 --- /dev/null +++ b/curriculumsearch/src/main/java/com/roshka/utils/PostulantesExcelExporter.java @@ -0,0 +1,142 @@ +package com.roshka.utils; + + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +import com.roshka.DTO.PostulanteListaDTO; +import com.roshka.modelo.PostulanteTecnologia; +import com.roshka.modelo.Tecnologia; +import org.apache.poi.ss.usermodel.Cell; +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.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +public class PostulantesExcelExporter { + private XSSFWorkbook workbook; + private XSSFSheet sheet; + private List listUsers; + private HashMap filtros; + + public PostulantesExcelExporter(List listUsers, HashMap filtros) { + this.listUsers = listUsers; + workbook = new XSSFWorkbook(); + this.filtros = filtros; + } + + + private void writeHeaderLine() { + sheet = workbook.createSheet("Postulantes"); + DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss"); + String currentDateTime = dateFormatter.format(new Date()); + + Row row = sheet.createRow(0); + CellStyle style = workbook.createCellStyle(); + XSSFFont font = workbook.createFont(); + font.setBold(true); + font.setFontHeight(14); + style.setFont(font); + createCell(row, 0, "Postulantes "+currentDateTime, style); + + row = sheet.createRow(2); + createCell(row, 0, "Filtros", style); + + row = sheet.createRow(3); + createCell(row, 0, "Nombre", style); + createCell(row, 1, "Nivel de Ingles", style); + createCell(row, 2, "Experiencia (Meses)", style); + createCell(row, 3, "Tecnologias", style); + createCell(row, 4, "Nivel Tecnologia", style); + createCell(row, 5, "Institucion", style); + createCell(row, 6, "Estado", style); + createCell(row, 7, "Convocatoria", style); + + + row = sheet.createRow(6); + style = workbook.createCellStyle(); + font = workbook.createFont(); + font.setBold(true); + font.setFontHeight(14); + style.setFont(font); + + createCell(row, 0, "Nombre", style); + createCell(row, 1, "Nivel de Ingles", style); + createCell(row, 2, "Experiencia", style); + createCell(row, 3, "Tecnologias", style); + createCell(row, 4, "Estado", style); + + row = sheet.createRow(4); + font.setBold(false); + font.setFontHeight(12); + style.setFont(font); + createCell(row, 0, filtros.get("nombre"), style); + createCell(row, 1, filtros.get("nivelIngles"), style); + createCell(row, 2, filtros.get("experienciaEnMeses"), style); + createCell(row, 3, filtros.get("tecnologia"), style); + createCell(row, 4, filtros.get("nivelTecnologia"), style); + createCell(row, 5, filtros.get("institucion"), style); + createCell(row, 6, filtros.get("estado"), style); + createCell(row, 7, filtros.get("convocatoria"), style); + + } + + private void createCell(Row row, int columnCount, Object value, CellStyle style) { + sheet.autoSizeColumn(columnCount); + Cell cell = row.createCell(columnCount); + if (value instanceof Integer) { + cell.setCellValue((Integer) value); + } else if (value instanceof Boolean) { + cell.setCellValue((Boolean) value); + }else { + cell.setCellValue((String) value); + } + cell.setCellStyle(style); + } + + private void writeDataLines() { + int rowCount = 7; + + CellStyle style = workbook.createCellStyle(); + XSSFFont font = workbook.createFont(); + font.setFontHeight(12); + style.setFont(font); + + for (PostulanteListaDTO user : listUsers) { + Row row = sheet.createRow(rowCount++); + int columnCount = 0; + + StringBuilder tecno = new StringBuilder(); + for(PostulanteTecnologia tecnologia: user.getTecnologias()){ + tecno.append(tecnologia.getTecnologia().getNombre()).append(" "); + } + + createCell(row, columnCount++, user.getNombre() + " " + user.getApellido(), style); + createCell(row, columnCount++, user.getNivelIngles().intValue(), style); + createCell(row, columnCount++, user.getExperienciaMeses().intValue(), style); + createCell(row, columnCount++, tecno.toString(), style); + createCell(row, columnCount++, user.getEstado().getEstado(), style); + tecno.delete(0, tecno.length()-1); + } + } + + public void export(HttpServletResponse response) throws IOException { + writeHeaderLine(); + writeDataLines(); + + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + workbook.close(); + + outputStream.close(); + + } +} \ No newline at end of file diff --git a/curriculumsearch/src/main/resources/json/postulante.json b/curriculumsearch/src/main/resources/json/postulante.json index e3f9e2a..34e0467 100644 --- a/curriculumsearch/src/main/resources/json/postulante.json +++ b/curriculumsearch/src/main/resources/json/postulante.json @@ -40,19 +40,19 @@ "tecnologias": [ { "tecnologia": { - "nombre": "JAVA" + "id": 1 }, "nivel": 5 }, { "tecnologia": { - "nombre": "Python" + "id": 2 }, "nivel": 4 }, { "tecnologia": { - "nombre": "C" + "id": 3 }, "nivel": 5 } @@ -99,7 +99,7 @@ "tecnologias": [ { "tecnologia": { - "nombre": "Spring" + "id": 4 }, "nivel": 2 } @@ -146,7 +146,7 @@ "tecnologias": [ { "tecnologia": { - "nombre": "Django" + "id": 5 }, "nivel": 3 } @@ -193,7 +193,7 @@ "tecnologias": [ { "tecnologia": { - "nombre": "Flutter" + "id": 6 }, "nivel": 2 } @@ -240,7 +240,7 @@ "tecnologias": [ { "tecnologia": { - "nombre": "Switf" + "id": 3 }, "nivel": 5 } @@ -287,7 +287,7 @@ "tecnologias": [ { "tecnologia": { - "nombre": "SL" + "id": 2 }, "nivel": 4 } @@ -334,7 +334,7 @@ "tecnologias": [ { "tecnologia": { - "nombre": "Scala" + "id": 5 }, "nivel": 5 } diff --git a/curriculumsearch/src/main/resources/json/tecnologia.json b/curriculumsearch/src/main/resources/json/tecnologia.json index fb148bf..70e424e 100644 --- a/curriculumsearch/src/main/resources/json/tecnologia.json +++ b/curriculumsearch/src/main/resources/json/tecnologia.json @@ -18,5 +18,17 @@ { "id": 5, "nombre": "spring" + }, + { + "id": 6, + "nombre": "php" + }, + { + "id": 7, + "nombre": "laravel" + }, + { + "id": 8, + "nombre": "sqlserver" } ] \ No newline at end of file diff --git a/curriculumsearch/src/main/resources/static/main.js b/curriculumsearch/src/main/resources/static/main.js index daad42f..091b1d1 100644 --- a/curriculumsearch/src/main/resources/static/main.js +++ b/curriculumsearch/src/main/resources/static/main.js @@ -175,7 +175,7 @@ function agregarFieldTecnologia(){ if(tecn==null) continue; content1 += `
- ${tecn.tecnologia.nombre} ( ${tecn.nivel} )   + ${tecn.tecnologia.nombre} ( ${tecn.nivel} )  
` @@ -267,7 +267,7 @@ function agregarFieldExpierncia(event){ if(exp==null) continue; content += `
-
Experiencia
+
Experiencia
Institucion
${exp.institucion}
@@ -380,7 +380,7 @@ function agregarFieldEstudio(){ if(est==null) continue; content += `
-
Estudio
+
Estudio
Institucion
${est.institucion.nombre}
@@ -473,7 +473,7 @@ function agregarFieldCargo(){ if(car==null) continue; content1 += `
- ${document.querySelector('[name=cargo-id] > option[value="'+car.id+'"]').innerHTML}   + ${document.querySelector('[name=cargo-id] > option[value="'+car.id+'"]').innerHTML}  
@@ -547,7 +547,7 @@ function agregarFieldReferencia(event){ if(exp==null) continue; content += `
-
Referencia Personal
+
Referencia Personal
Nombre
${exp.nombre}
diff --git a/curriculumsearch/src/main/webapp/css/formPostulanteStyle.css b/curriculumsearch/src/main/webapp/css/formPostulanteStyle.css index 105dde9..8d4ecf0 100644 --- a/curriculumsearch/src/main/webapp/css/formPostulanteStyle.css +++ b/curriculumsearch/src/main/webapp/css/formPostulanteStyle.css @@ -213,4 +213,121 @@ h4{ } form[name="postulante"]{ color: #ffffff; -} \ No newline at end of file +} + +.form-check-input:checked { + background-color: #198754; + border-color: #0d6efd; +} + +label:hover { + color: #bfbfbf; +} +/*ICONOS Y PLACEHOLDER*/ +.FA{ + font-family: 'Shippori Antique B1',FontAwesome; +} + + +#nroDocument::-webkit-outer-spin-button, +#nroDocument::-webkit-inner-spin-button +{ + -webkit-appearance: none; + margin: 0; +} +#nroDocument[type=number] { + -moz-appearance: textfield; +} +#telefono::-webkit-outer-spin-button, +#telefono::-webkit-inner-spin-button +{ + -webkit-appearance: none; + margin: 0; +} +#telefono[type=number] { + -moz-appearance: textfield; +} +#refTel::-webkit-outer-spin-button, +#refTel::-webkit-inner-spin-button +{ + -webkit-appearance: none; + margin: 0; +} +#refTel[type=number] { + -moz-appearance: textfield; +} +.pointer {cursor: pointer;} +/* + +.size-placeholder::placeholder{ + background-size: 18px 18px; + background-repeat: no-repeat; + background-position: right center; + + +} +/*Nombre +.nombre-ph::placeholder{ + background-image: url(../img/placeholder/name_ph.png); +} +Apellido +#apellido::placeholder{ + background-image: url(../img/placeholder/lastname_ph.png); +} +Email +#correo::placeholder{ + background-image: url(../img/placeholder/email_ph.png); +} +Numero de documento*/ + +/* +.nroDocument-ph::placeholder{ + background-image: url(../img/placeholder/nroDocumento_ph.png); + margin-left: 5px; +} +Direccion +#direccion::placeholder{ + background-image: url(../img/placeholder/adress_ph.png); + background-size: 14px 14px; +}*/ +/*Telefono*/ + +/* +.telefono-ph::placeholder{ + background-image: url(../img/placeholder/telephone_ph.png); +} +/*Modal Estudio +#institucionEstudio::placeholder{ + background-image: url(../img/placeholder/studios_ph.png); +} +#temaDeEstudio::placeholder{ + background-image: url(../img/placeholder/studios_ph.png); +} + +#institucionExperiencia::placeholder{ + background-image: url(../img/placeholder/studios_ph.png); +} +#cargo::placeholder{ + background-image: url(../img/placeholder/cargo_ph.png); +} + +#descripcion::placeholder{ + background-image: url(../img/placeholder/description_ph.png); +} +#refNombre::placeholder{ + background-image: url(../img/placeholder/name_ph.png); +}*/ + +/* +.telefono-ph::placeholder{ + background-image: url(../img/placeholder/telephone_ph.png); +} +#motivoSalida::placeholder{ + background-image: url(../img/placeholder/motivoSalida_ph.png); +} +#relacion::placeholder{ + background-image: url(../img/placeholder/relacion_ph.png); +} +*/ +/*Prueba Font Awesome*/ + diff --git a/curriculumsearch/src/main/webapp/img/placeholder/adress_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/adress_ph.png new file mode 100644 index 0000000..67955ba Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/adress_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/building_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/building_ph.png new file mode 100644 index 0000000..f631308 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/building_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/cargo_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/cargo_ph.png new file mode 100644 index 0000000..0d9b3c4 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/cargo_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/description_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/description_ph.png new file mode 100644 index 0000000..7d99dfb Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/description_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/email_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/email_ph.png new file mode 100644 index 0000000..8c9ed67 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/email_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/lastname_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/lastname_ph.png new file mode 100644 index 0000000..f4e8f54 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/lastname_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/motivoSalida_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/motivoSalida_ph.png new file mode 100644 index 0000000..7ffec61 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/motivoSalida_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/name_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/name_ph.png new file mode 100644 index 0000000..16f3113 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/name_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/nroDocumento_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/nroDocumento_ph.png new file mode 100644 index 0000000..12f8f27 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/nroDocumento_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/relacion_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/relacion_ph.png new file mode 100644 index 0000000..7dfb0d8 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/relacion_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/studios_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/studios_ph.png new file mode 100644 index 0000000..cb079e5 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/studios_ph.png differ diff --git a/curriculumsearch/src/main/webapp/img/placeholder/telephone_ph.png b/curriculumsearch/src/main/webapp/img/placeholder/telephone_ph.png new file mode 100644 index 0000000..ca29092 Binary files /dev/null and b/curriculumsearch/src/main/webapp/img/placeholder/telephone_ph.png differ diff --git a/curriculumsearch/src/main/webapp/jsp/cargos.jsp b/curriculumsearch/src/main/webapp/jsp/cargos.jsp index dad22a0..cfa6c05 100644 --- a/curriculumsearch/src/main/webapp/jsp/cargos.jsp +++ b/curriculumsearch/src/main/webapp/jsp/cargos.jsp @@ -20,40 +20,45 @@ contentType="text/html;charset=UTF-8" language="java" %> Agregar Nuevo Cargo
-
- - - - - - - - - +
+ +
+
+
#Cargo
+ - - - - + + - - -
${sta.index+1}${cargo.getNombre()} - Ver Convocatorias - Editar cargo#Cargo
+ + + + + ${sta.index+1} + ${cargo.getNombre()} + + Ver Convocatorias + + Editar cargo + + + + +
+
- - diff --git a/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp b/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp index 0ec4cbc..aeb1375 100644 --- a/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp +++ b/curriculumsearch/src/main/webapp/jsp/convocatorias.jsp @@ -2,6 +2,8 @@ <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://kwonnam.pe.kr/jsp/template-inheritance" prefix="layout"%> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> + @@ -25,12 +27,16 @@ -
- Agregar Nueva Convocatoria - -
${SUCCESS_MESSAGE}
-
- + + Agregar Nueva Convocatoria + +
${SUCCESS_MESSAGE}
+
+
+ +
+
+
@@ -47,9 +53,9 @@ - - - + + + @@ -57,8 +63,9 @@ -
#${sta.index+1} ${convocatoria.getCargo().getNombre()} ${convocatoria.getEstado().getDescripcion()}${convocatoria.getFechaInicio().toString().split(" ")[0]}${convocatoria.getFechaFin().toString().split(" ")[0]}Ver PostulantesVer postulantes
- + +
+
diff --git a/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp b/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp index f191f7f..25a745b 100644 --- a/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp +++ b/curriculumsearch/src/main/webapp/jsp/detallepostulante.jsp @@ -7,385 +7,426 @@ -

- DETALLE POSTULANTE -

-
-
-
-
-
-
-
Nombre
-
-
- ${postulante.nombre} ${postulante.apellido} -
-
-
-
-
-
Email
-
-
- ${postulante.correo} -
-
-
-
-
-
Vive en
-
-
- ${postulante.getCiudad().getNombre()}, ${postulante.getCiudad().getDepartamento().getNombre()} -
-
-
-
-
-
Nro de Documento
-
-
- ${postulante.tipoDocumento}: ${postulante.nroDocument} -
-
-
-
-
-
Telefono
-
-
- ${postulante.telefono} -
-
-
-
-
-
Edad
-
-
- -
-
-
-
-
Direccion
-
-
- ${postulante.direccion} -
-
-
-
-
-
Nivel de Ingles
-
-
- ${postulante.nivelIngles} -
-
-
-
-
-
Estado Civil
-
-
- ${postulante.estadoCivil.getDescripcion()} -
-
-
-
-
-
Nacionalidad
-
-
- ${postulante.nacionalidad.getDescripcion()} -
-
-
-
-
-
Disponbilidad
-
-
- ${postulante.disponibilidad.getDescripcion()} -
-
-
-
-
-
Estado
-
-
- ${postulante.estadoPostulante.getEstado()} -
-
-
-
-
-
ComentarioRRHH
-
-
- ${postulante.getComentarioRRHH()} -
-
-
-
-
- -
- - - - - - - - -
-
-
- -
-
-
-
-
-
-
Tecnologias
- - ${detalle_tecnologia.getTecnologia().getNombre()} -
-
-
-
-
-
Cargos al que postula
-
    - - -
  • -
    ${convocatoria.getCargo().getNombre()}
    - -
  • -
    - -
- -
-
-
-
-
-
- +
+

+ Detalle Postulante ${postulante.nombre} ${postulante.apellido} +

+
+
+
+
+
+
+
Nombre
+
+
+ ${postulante.nombre} ${postulante.apellido} +
-
-
-
-
-
- -
-
-
-
-
-
-
Referencias Personales
-
    - - -
  • -
    ${referencia.nombre}, ${referencia.relacion}, ${referencia.telefono}
    - -
  • -
    -
-
-
-
-
- - - -
- - +
+
+
+
Email
+
+
+ ${postulante.correo} +
+
+
+
+
+
Vive en
+
+
+ ${postulante.getCiudad().getNombre()}, ${postulante.getCiudad().getDepartamento().getNombre()} +
+
+
+
+
+
Nro de Documento
+
+
+ ${postulante.tipoDocumento}: ${postulante.nroDocument} +
+
+
+
+
+
Telefono
+
+
+ ${postulante.telefono} +
+
+
+
+
+
Edad
+
+
+ +
+
+
+
+
Direccion
+
+
+ ${postulante.direccion} +
+
+
+
+
+
Nivel de Ingles
+
+
+ ${postulante.nivelIngles} +
+
+
+
+
+
Estado Civil
+
+
+ ${postulante.estadoCivil.getDescripcion()} +
+
+
+
+
+
Nacionalidad
+
+
+ ${postulante.nacionalidad.getDescripcion()} +
+
+
+
+
+
Disponbilidad
+
+
+ ${postulante.disponibilidad.getDescripcion()} +
+
+
+
+
+
Estado
+
+
+ ${postulante.estadoPostulante.getEstado()} +
+
+
+
+
+
ComentarioRRHH
+
+
+ ${postulante.getComentarioRRHH()} +
+
+
+
+
+ + +
+ + + + + + + + + +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
Tecnologias
+ + ${detalle_tecnologia.getTecnologia().getNombre()} +
+
+
+
+
+
Cargos al que postula
+
    + + +
  • +
    ${convocatoria.getCargo().getNombre()}
    + +
  • +
    + +
+ +
+
+
+
+
+
+
Referencias Personales
+
    + + +
  • +
    ${referencia.nombre}, ${referencia.relacion}, ${referencia.telefono}
    + +
  • +
    +
+
+
+
+
+ + + +
+ + + +
- + + + diff --git a/curriculumsearch/src/main/webapp/jsp/detallepostulante2.jsp b/curriculumsearch/src/main/webapp/jsp/detallepostulante2.jsp index 1bfad4c..898022f 100644 --- a/curriculumsearch/src/main/webapp/jsp/detallepostulante2.jsp +++ b/curriculumsearch/src/main/webapp/jsp/detallepostulante2.jsp @@ -1,164 +1,397 @@ - <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> - - - - - - - Curriculum vitae - - - - - -
-
-
-

     ${postulante.nombre} ${postulante.apellido}

-

     ${postulante.tipoDocumento}: ${postulante.nroDocument}

-

     Correo: ${postulante.correo}

-
-
-
-
-
-
-

  Informacion Personal

-
    -
  • - Direccion: ${postulante.getCiudad().getDepartamento().getNombre()},${postulante.getCiudad().getNombre()} -
  • -
  • - Telefono: ${postulante.telefono} -
  • -
  • - Fecha de nacimiento: ${postulante.fechaNacimiento} -
  • -
  • - Nivel de ingles:   -
  • -
  • - Estado civil: ${postulante.estadoCivil} -
  • -
  • - Nacionalidad: ${postulante.nacionalidad} -
  • -
  • - Disponibilidad: ${postulante.disponibilidad} -
  • -
  • - Direccion: ${postulante.direccion} -
  • -
-
-

  TECNOLOGIAS

-
    - -
    -
    -
-
-

  Cargo al que Postula

-
    - -
  • Nombre: ${convocatoria.getCargo().getNombre()}

  • -
    -
-
-

  Estado RRHH

-
    -
  • Estado del Postulante: ${postulante.estadoPostulante.getEstado()}
  • -
  • Comentario RRHH: ${postulante.getComentarioRRHH()}
  • - - -
-
- - -
- -