Java兼职平台系统如何实现(java,开发技术)

时间:2024-05-07 17:07:54 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :

一、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

HTML +Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + maven等等.

二、效果图

Java兼职平台系统如何实现

Java兼职平台系统如何实现

Java兼职平台系统如何实现

Java兼职平台系统如何实现

Java兼职平台系统如何实现

Java兼职平台系统如何实现

Java兼职平台系统如何实现

三、核心代码

登录控制层

/***@Authoryy*@Description登录*@Date2022.2.17*/publicclassLoginControllerextendsHttpServlet{@OverrideprotectedvoiddoGet(HttpServletRequestreq,HttpServletResponseresp)throwsIOException{JSONObjectjsonObject=newJSONObject();Stringusername=req.getParameter("username");Stringpassword=req.getParameter("password");resp.setCharacterEncoding("UTF-8");HttpSessionsession=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);BusinessUserVObusinessUserVO=newBusinessUserVO();businessUserVO.setUsername(username);businessUserVO.setPassword(password);StudentUserVOstudentUserVO=newStudentUserVO();studentUserVO.setUsername(username);studentUserVO.setPassword(password);Stringflag1=null;Stringflag2=null;try{flag1=BusinessUserDao.selectUsername(businessUserVO);if("ok".equals(flag1)){//企业用户名存在BusinessUserDTObusinessUserDTO=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)){//学生用户名存在StudentUserstudentUser=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(SQLExceptionthrowables){throwables.printStackTrace();}return;}@OverrideprotectedvoiddoPost(HttpServletRequestreq,HttpServletResponseresp)throwsIOException{doGet(req,resp);}}

管理员登录控制层

publicclassAdminLoginControllerextendsHttpServlet{@SneakyThrows@OverrideprotectedvoiddoGet(HttpServletRequestreq,HttpServletResponseresp)throwsServletException,IOException{Stringusername=req.getParameter("username");Stringpassword=req.getParameter("password");password=MyMD5Util.encrypt(password);JSONObjectjsonObject=newJSONObject();HttpSessionsession=req.getSession();Adminadmin=newAdmin(username,password);AdminadminFromDB=AdminDao.findByUsernamePassword(admin);if(adminFromDB!=null){jsonObject.put("code",2000);jsonObject.put("msg","login_success");jsonObject.put("admin",adminFromDB.getUsername());jsonObject.put("flag","success");resp.getWriter().print(jsonObject);session.setAttribute("admin",adminFromDB);return;}else{jsonObject.put("code",2000);jsonObject.put("msg","noadmin");jsonObject.put("admin",null);jsonObject.put("flag","fail");resp.getWriter().print(jsonObject);return;}}@OverrideprotectedvoiddoPost(HttpServletRequestreq,HttpServletResponseresp)throwsServletException,IOException{this.doGet(req,resp);}}

提交个人简介控制层

publicclassSubmitResumeControllerextendsHttpServlet{@SneakyThrows@OverrideprotectedvoiddoGet(HttpServletRequestreq,HttpServletResponseresp)throwsServletException,IOException{JSONObjectjsonObject=newJSONObject();DiskFileItemFactoryfactory=newDiskFileItemFactory();ServletFileUploadupload=newServletFileUpload(factory);req.setCharacterEncoding("UTF-8");upload.setHeaderEncoding("UTF-8");List<FileItem>items=upload.parseRequest(req);StringBuffersb=newStringBuffer();StringresumeFile=null;for(FileItemitem:items){Stringname=item.getFieldName();InputStreaminputStream=item.getInputStream();if(!name.equals("resumeFile")){Stringstring=item.getString();string=newString(string.getBytes("ISO8859_1"),StandardCharsets.UTF_8);sb.append(string+"&&");}else{String[]split=sb.toString().split("&&");StringstudentName=split[0];StringstudentUsername=split[1];StringrecruitInfoId=split[2];Stringpath=req.getServletContext().getRealPath("/");StringfieldName=studentName+"_"+studentUsername+"_"+recruitInfoId+"_"+item.getName();StringfilePath=path+fieldName;resumeFile=fieldName;Filefile=newFile(filePath);BufferedInputStreambufferedInputStream=newBufferedInputStream(inputStream);FileOutputStreamfileOutputStream=newFileOutputStream(file);intline;while((line=bufferedInputStream.read())!=-1){fileOutputStream.write(line);}fileOutputStream.flush();fileOutputStream.close();bufferedInputStream.close();}}String[]split=sb.toString().split("&&");StringstudentName=split[0];StringstudentUsername=split[1];StringrecruitInfoId=split[2];StringapplyPosition=split[3];StringphoneNum=split[4];Stringemail=split[5];Resumeresume=newResume(studentUsername,Integer.parseInt(recruitInfoId),studentName,applyPosition,phoneNum,email,resumeFile);intinsert=ResumeDao.insert(resume);if(insert==1){jsonObject.put("code",2000);jsonObject.put("msg","addsuccess");jsonObject.put("flag","success");jsonObject.put("data",resume);resp.getWriter().print(jsonObject);return;}else{jsonObject.put("code",2000);jsonObject.put("msg","addfail");jsonObject.put("flag","fail");jsonObject.put("data",null);resp.getWriter().print(jsonObject);}}@OverrideprotectedvoiddoPost(HttpServletRequestreq,HttpServletResponseresp)throwsServletException,IOException{this.doGet(req,resp);}}
 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:Java兼职平台系统如何实现的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:springcloud feign服务间调用date类型转换错误怎么解决下一篇:

5 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18