ems.web.controller.other.HireInitController.java Source code

Java tutorial

Introduction

Here is the source code for ems.web.controller.other.HireInitController.java

Source

package ems.web.controller.other;

import ems.web.model.dto.LoginCompleteDTO;
import ems.web.model.dto.MemberDTO;
import ems.web.model.service.resume.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

/**
 * Created by jinho on 2016-07-18.
 */
@Controller
@RequestMapping("hire")
public class HireInitController {

    @Autowired
    ResumeService resumeServiceImpl;

    @RequestMapping(value = "/hireApply", method = RequestMethod.GET)
    public ModelAndView initResumeForm(@RequestParam String comName, HttpSession httpSession) {
        int memberCode = ((LoginCompleteDTO) httpSession.getAttribute("loginMember")).getCode();

        return new ModelAndView("/hire/hireApply").addObject("name", comName)
                .addObject("academicAbility", resumeServiceImpl.selectAcademicAbility(memberCode))
                .addObject("license", resumeServiceImpl.selectLicense(memberCode))
                .addObject("career", resumeServiceImpl.selectCareer(memberCode))
                .addObject("memberData", resumeServiceImpl.getResumeInitUserData(
                        ((LoginCompleteDTO) httpSession.getAttribute("loginMember")).getId()));
    }

    @RequestMapping(value = "/clickApply", method = RequestMethod.POST)
    public String hireApply(String content, String email, String subject, MultipartFile file, HttpSession session) {
        MemberDTO member = (MemberDTO) session.getAttribute("loginMember");
        if (member.getType().equals("student")) {

            return resumeServiceImpl.hireApply(content, email, subject, file);
        } else
            return "redirect:../error/errorMessage";

    }
}