Пример #1
0
  @RequestMapping(
      value = {"/offers/apply/{offerId}"},
      method = RequestMethod.GET)
  public ModelAndView applyOffer(@PathVariable String offerId, HttpServletRequest request)
      throws IOException {

    ModelAndView mv = new ModelAndView("displayOffers");
    super.setFooterDisPlayON(mv);
    mv.addObject("mainClass", mainClass);

    String candidatId = (String) request.getSession().getAttribute(AController.USER_ID);
    super.setAuth();

    ClientOffers byId = clientsJobsService.getById(offerId);
    mv.addObject("offers", byId);
    if (super.authName != null
        && !super.authName.isEmpty()
        && !"anonymousUser".equals(super.authName)
        && !"ROLE_CLIENT".equals(super.getAuthType())) {

      ArrayList<CandidatOffers> byOfferId = candidatOffersService.getByOfferId(offerId);
      boolean alreadyApply = false;
      for (CandidatOffers offer : byOfferId) {

        if (candidatId == null
            ? offer.getPartialCandidat().getId() == null
            : candidatId.equals(offer.getPartialCandidat().getId())) {
          alreadyApply = true;
          break;
        }
      }
      if (!alreadyApply) {

        CandidatOffers candidatOffers = new CandidatOffers();
        candidatOffers.setId(UUID.randomUUID().toString());
        candidatOffers.setDate(new Date().toString());
        PartialCandidat partialCandidat = new PartialCandidat();
        partialCandidat.setId(candidatId);
        candidatOffers.setOfferId(offerId);
        candidatOffers.setPartialCandidat(partialCandidat);
        candidatOffersService.addCandidatOffers(candidatOffers);
        this.sendApplicationMail(candidatOffers, byId);
        mv.addObject("applyOk", true);
      } else {
        mv.addObject("alreadyApply", alreadyApply);
      }

    } else {
      mv.addObject("noAuth", true);
    }

    return mv;
  }
Пример #2
0
  /**
   * @param departement
   * @param text
   * @return
   * @throws IOException
   * @throws org.springframework.web.servlet.NoHandlerFoundException
   */
  @RequestMapping(
      value = {"/"},
      method = RequestMethod.POST)
  public ModelAndView seachPage(String departement, String text)
      throws IOException, NoHandlerFoundException {

    ModelAndView mv = new ModelAndView("cerebros");
    mv.addObject("noRes", false);
    mv.addObject("mainClass", mainClass);
    text = this.removeSpecialChar(text);

    super.setFooterDisPlayON(mv);
    mv.addObject("normalFooter", true);
    List<ClientOffers> findByTerms = clientsJobsService.findByTerms(departement, text);
    mv.addObject("departement", departement);
    mv.addObject("text", text);

    if (!findByTerms.isEmpty()) {

      mv.addObject("res", findByTerms);
      mv.addObject("noRes", false);

    } else {
      mv.addObject("noRes", true);
    }

    mv.addObject("page", "home");
    return mv;
  }
Пример #3
0
  @RequestMapping(
      value = {"/offers/{offerId}"},
      method = RequestMethod.GET)
  public ModelAndView displayOffer(@PathVariable String offerId) throws IOException {

    ModelAndView mv = new ModelAndView("displayOffers");
    super.setFooterDisPlayON(mv);
    mv.addObject("mainClass", mainClass);
    ClientOffers byId = clientsJobsService.getById(offerId);
    mv.addObject("offers", byId);
    return mv;
  }
Пример #4
0
  @RequestMapping(
      value = {"/"},
      method = RequestMethod.GET)
  public ModelAndView home() throws NoHandlerFoundException {

    ModelAndView mv = new ModelAndView("cerebros");
    super.setFooterDisPlayON(mv);
    mv.addObject("noRes", false);
    mv.addObject("page", "home");
    mv.addObject("mainClass", mainClass);

    return mv;
  }