Java项目:招聘系统项目(java+SpringBoot+HTML+JSP+Maven+mysql)

源码获取:博客首页 "资源" 里下载!

项目介绍

SpringBoot招聘项目。主要功能说明: 管理员登录,简历管理,问答管理,职位管理,用户管理,职位申请进度更新,查看简历等功能。

用户角色包含以下功能:用户首页,登录注册,职位查看,职位详情,投递简历,查看我的申请,管理个人简历,附件简历管理等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 5.7版本;

技术栈

1. 后端:SpringBoot

2. 前端:HTML+CSS+JavaScript+jsp

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
3. 将项目中datasource.properties配置文件中的数据库配置改为自己的配置
4. 配置tomcat,然后运行项目,在浏览器中输入http://localhost:8080/ 登录
管理员账号/密码:admin/123456
用户账号/密码: matou/123456

 

 

 

 

 

登录管理控制层:

public class LoginController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        JSONObject jsonObject = new JSONObject();
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        resp.setCharacterEncoding("UTF-8");

        HttpSession session = req.getSession();
        if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
            jsonObject.put("code", 2000);
            jsonObject.put("flag", "fail");
            jsonObject.put("user", null);
            jsonObject.put("msg", "usernameOrPasswordIsBank");//用户名密码不能为空
            resp.getWriter().print(jsonObject);
            return;
        }
        password = MyMD5Util.encrypt(password);
        System.out.println(password);
        BusinessUserVO businessUserVO = new BusinessUserVO();
        businessUserVO.setUsername(username);
        businessUserVO.setPassword(password);
        StudentUserVO studentUserVO = new StudentUserVO();
        studentUserVO.setUsername(username);
        studentUserVO.setPassword(password);

        String flag1 = null;
        String flag2 = null;
        try {
            flag1 = BusinessUserDao.selectUsername(businessUserVO);
            if ("ok".equals(flag1)) {//企业用户名存在
                BusinessUserDTO businessUserDTO = BusinessUserDao.select(businessUserVO);
                if (businessUserDTO != null) {
                    jsonObject.put("code", 2000);
                    jsonObject.put("flag", "success");//登录成功
                    jsonObject.put("user", businessUserDTO);
                    jsonObject.put("msg", "login_success");
                    session.setAttribute("businessUser",businessUserDTO);
                    resp.getWriter().print(jsonObject);
                    return;
                } else {
                    jsonObject.put("code", 2000);
                    jsonObject.put("flag", "fail");//登录失败
                    jsonObject.put("user", null);
                    jsonObject.put("msg", "passwordError");//密码错误
                    resp.getWriter().print(jsonObject);
                    return;
                }
            }
            flag2 = StudentUserDao.selectUsername(studentUserVO);
            if ("ok".equals(flag2)) {//学生用户名存在
                StudentUser studentUser = StudentUserDao.select(studentUserVO);
                if (studentUser != null) {
                    jsonObject.put("code", 2000);
                    jsonObject.put("flag", "success");//登录成功
                    jsonObject.put("user", studentUser);
                    jsonObject.put("msg", "login_success");
                    session.setAttribute("studentUser",studentUser);
                    resp.getWriter().print(jsonObject);
                    return;
                } else {
                    jsonObject.put("code", 2000);
                    jsonObject.put("flag", "fail");//登录失败
                    jsonObject.put("user", null);
                    jsonObject.put("msg", "passwordError");//密码错误
                    resp.getWriter().print(jsonObject);
                    return;
                }

            }
            //用户名不存在,前往注册
            jsonObject.put("code", 2000);
            jsonObject.put("flag", "fail");//登录失败
            jsonObject.put("user", null);
            jsonObject.put("msg", "usernameIsNotExist");//密码错误
            resp.getWriter().print(jsonObject);
            return;

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return;

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        doGet(req, resp);
    }
}

简历管理控制层:

@MultipartConfig
public class ResumeController extends HttpServlet {

    private static int MAX_POST_SIZE = 1024*1024*100;


    @SneakyThrows
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String operate = req.getParameter("operate");
        JSONObject jsonObject = new JSONObject();
        resp.setCharacterEncoding("UTF-8");
        if (operate.equals("add")){//投递简历与上传简历文件
            String studentName = req.getParameter("studentName");
            String studentUsername = req.getParameter("studentUsername");
            String recruitInfoId = req.getParameter("recruitInfoId");
            String applyPosition = req.getParameter("applyPosition");
            String phoneNum = req.getParameter("phoneNum");
            String email = req.getParameter("email");
            String attachmentResume = "文件名";

            Resume resume = new Resume(studentUsername, Integer.parseInt(recruitInfoId), studentName, applyPosition, phoneNum, email, attachmentResume);
            int insert = 0;
            try {
                insert = ResumeDao.insert(resume);
                if (insert == 1){
                    jsonObject.put("code",2000);
                    jsonObject.put("msg","add success");
                    jsonObject.put("flag","success");
                    jsonObject.put("data",resume);
                    resp.getWriter().print(jsonObject);
                }else {
                    jsonObject.put("code",2000);
                    jsonObject.put("msg","add fail");
                    jsonObject.put("flag","fail");
                    jsonObject.put("data",null);
                    resp.getWriter().print(jsonObject);
                }
            } catch (SQLException throwables) {
                throwables.printStackTrace();
                jsonObject.put("code",5000);
                jsonObject.put("msg","server error");
                jsonObject.put("flag","fail");
                jsonObject.put("data",null);
                resp.getWriter().print(jsonObject);
            }
        }else if (operate.equals("download")){//下载简历
            String file = req.getParameter("file"); //客户端传递的需要下载的文件名
            String path = req.getServletContext().getRealPath("")+"/"+file; //默认认为文件在当前项目的根目录
            FileInputStream fis = new FileInputStream(path);
            resp.setCharacterEncoding("utf-8");
            resp.setHeader("Content-Disposition", "attachment; filename="+file);
            ServletOutputStream out = resp.getOutputStream();
            byte[] bt = new byte[1024];
            int length = 0;
            while((length=fis.read(bt))!=-1){
                out.write(bt,0,length);
            }
            out.close();
        }else if (operate.equals("findByRecruitInfoId")){
            String recruitInfoId = req.getParameter("recuitInfoId");
            System.out.println(recruitInfoId);
            List<Resume> byRecruitInfoID = ResumeDao.findByRecruitInfoID(Integer.parseInt(recruitInfoId));
            jsonObject.put("code",2000);
            jsonObject.put("msg","success");
            jsonObject.put("flag","success");
            jsonObject.put("data",byRecruitInfoID);
            resp.getWriter().print(jsonObject);
        } else if (operate.equals("findByStuUsername")){
            String studentUsername = req.getParameter("studentUsername");
            List<Resume> byRecruitInfoID = ResumeDao.findByStudentUsername(studentUsername);
            jsonObject.put("code",2000);
            jsonObject.put("msg","success");
            jsonObject.put("flag","success");
            jsonObject.put("data",byRecruitInfoID);
            resp.getWriter().print(jsonObject);
        } else if (operate.equals("findRecruitInfoByStuUsername")){
            String studentUsername = req.getParameter("studentUsername");
            List<Integer> rids = ResumeDao.findRecruitInfoIdByStudentUsername(studentUsername);
            List<RecruitInformation> list = new ArrayList<>();
            for (Integer rid : rids) {
                RecruitInformation information = RecruitInformationDao.selectByRecruitInfoId(rid);
                list.add(information);
            }
            jsonObject.put("code",2000);
            jsonObject.put("msg","success");
            jsonObject.put("flag","success");
            jsonObject.put("data",list);
            resp.getWriter().print(jsonObject);
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}

用户注册控制层:

/**
 * 用户注册
 */
public class RegisterController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        String rePassword = req.getParameter("rePassword");//确认密码
        password=MyMD5Util.encrypt(password);
        JSONObject jsonObject = new JSONObject();

        StudentUserVO studentUser = new StudentUserVO();
        studentUser.setUsername(username);
        studentUser.setPassword(password);
        try {
            String flag2 = StudentUserDao.selectUsername(studentUser);
            if ("ok".equals(flag2)){//用户名已存在
                jsonObject.put("code",2000);
                jsonObject.put("flag","fail");//注册失败
                jsonObject.put("msg","usernameIsExist");//用户名已存在
                resp.getWriter().print(jsonObject);
                return;
            }else {
                StudentUser user = new StudentUser();
                user.setUsername(username);
                user.setPassword(password);
                StudentUserDao.insert(user);
                jsonObject.put("code",2000);
                jsonObject.put("flag","success");//注册成功
                jsonObject.put("msg","register_success");
                jsonObject.put("user",user);
                resp.getWriter().print(jsonObject);
                return;
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}

源码获取:博客首页 "资源" 里下载! 

评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

OldWinePot

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值