package com.wyxeainn.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.wyxeainn.pojo.*;
import com.wyxeainn.service.*;
import com.wyxeainn.tools.SMSUtil;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import sun.misc.BASE64Decoder;
import javax.servlet.http.HttpSession;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.*;
import java.io.File;
@Controller
public class SeekerController {
private SeekerService seekerService = new SeekerServiceImpl();
private CodeService codeService = new CodeServiceImpl();
private IndustryService industryService = new IndustryServiceImpl();
private CityService cityService = new CityServiceImpl();
private SocialService socialService = new SocialServiceImpl();
private EduService eduService = new EduServiceImpl();
private ProjectService projectService = new ProjectServiceImpl();
private PracticeService practiceService = new PracticeServiceImpl();
private HopeService hopeService = new HopeServiceImpl();
private BossService bossService = new BossServiceImpl();
/**
* 判断求职者信息表中手机号码是否存在
*
* @param params
* @return
*/
@RequestMapping(value = "/jobSeeker/accountExist.action")
public @ResponseBody boolean accountExist(@RequestBody String params) {
JSONObject obj = JSON.parseObject(params);
String phone = obj.getString("phone");
//seekerService = new SeekerServiceImpl();
boolean flag = seekerService.accountExist(phone);
return flag;
}
@RequestMapping(value = "/seeker/updatePhone.action")
public @ResponseBody boolean updatePhone(@RequestBody String params) {
boolean flag = true;
JSONObject obj = JSON.parseObject(params);
String code = obj.getString("code");
String oldPhone = obj.getString("oldPhone");
String newPhone = obj.getString("newPhone");
String id = obj.getString("id");
String identity = obj.getString("identity");
//codeService = new CodeServiceImpl();
//seekerService = new SeekerServiceImpl();
String smsCode = codeService.getCode(newPhone);
if(smsCode.equals(code)) {
try {
if (identity.equals("seeker")) {
Seeker seeker = new Seeker();
seeker.setPhone(newPhone);
seeker.setId(Integer.parseInt(id));
seekerService.updatePhoneById(seeker);
} else {
Boss boss = new Boss();
boss.setPhone(newPhone);
boss.setId(Integer.parseInt(id));
bossService.updatePhoneById(boss);
}
} catch (Exception ex) {
ex.printStackTrace();
flag = false;
}
} else {
flag = false;
}
return flag;
}
@RequestMapping(value = "/sendMessage/sendToSeeker.action")
public @ResponseBody boolean sendMessageToSeeker(@RequestBody String params) {
JSONObject obj = JSON.parseObject(params);
String phone = obj.getString("phone");
String code = "";
int x;
for(int i = 0; i < 6; i++) {
x = (int)(Math.random()*10);
code += x;
}
String content = "您的验证码是" + code + ",在1分钟内输入有效。如非本人操作请忽略本短信。【知心招聘】";
SMSUtil smsUtil = new SMSUtil();
boolean flag = smsUtil.send(phone,content);
//codeService = new CodeServiceImpl();
if(flag) {
boolean exist = codeService.phoneExist(phone);
Code c = new Code();
c.setId(phone);
c.setCode(code);
//存在,更新动态码字段
if(exist==true) {
codeService.updateCode(c);
}else {
//否则新插入一条记录
codeService.insertCode(c);
}
}
return flag;
}
@RequestMapping(value = "/userRegister/checkCode.action")
public @ResponseBody Boolean checkCode(@RequestBody String params){
JSONObject obj = JSON.parseObject(params);
String phone = obj.getString("phone");
String code = obj.getString("code");
//codeService = new CodeServiceImpl();
String c = codeService.getCode(phone);
if(code.equals(c)) {
return true;
}else {
return false;
}
}
//注册功能
@RequestMapping(value = "/jobSeeker/register.action")
public @ResponseBody boolean jobSeekerRegister(@RequestBody String params) {
JSONObject obj = JSON.parseObject(params);
String phone = obj.getString("phone");
Seeker seeker = new Seeker();
seeker.setPhone(phone);
Boss boss = new Boss();
boss.setPhone(phone);
//codeService = new CodeServiceImpl();
//bossService = new BossServiceImpl();
//seekerService = new SeekerServiceImpl();
boolean flag = true;
try {
if(codeService.phoneExist(phone)==false) {
Code code = new Code();
code.setId(phone);
code.setCode("123456");
codeService.insertCode(code);
}
seekerService.insertSeeker(seeker);
bossService.registerBoss(boss);
}catch(Exception ex) {
flag = false;
}
return flag;
}
/**
* 进入到职位搜索界面
* @param session
* @return
*/
@RequestMapping(value = "seeker/searchJob.action")
public String searchJob (HttpSession session) {
setData(session);
return "/Jobseeker/searchJob.jsp";
}
/**
* 设置需要的数据
* @param session
*/
public void setData(HttpSession session) {
session.setAttribute("Categorys",getCategory());
session.setAttribute("Industrys",getFullIndustry());
session.setAttribute("Citys",getCitys());
}
/**
* 求职者首页
* @param session
* @return
*/
@RequestMapping(value = "seeker/homepage.action")
public String seekerHomepage(HttpSession session) {
setData(session);
return "/Common/seeker_homepage.jsp";
}
/**
* 求职者首页导航栏链接。
* @param session
* @param cateId
* @param compName
* @param city
* @return
*/
@RequestMapping(value = "seeker/searchJobWithCondition.action")
public String searchJobWithCondition(HttpSession session,String cateId,String cateName,String compName,String city) {
setData(session);
return "/Jobseeker/searchJob.jsp";
}
@RequestMapping(value = "user/login.action")
public String userLogin(HttpSession session, String chose, String phone) {
String targetUrl = "";
if(chose.equals("求职者")) {
//seekerService = new SeekerServiceImpl();
Seeker seeker = seekerService.selectSeekerByPhone(phone);
session.setAttribute("uid",seeker.getId());
session.setAttribute("Categorys",getCategory());
session.setAttribute("Industrys",getFullIndustry());
session.setAttribute("Citys",getCitys());
session.setAttribute("identity","seeker");
targetUrl = "/Common/seeker_homepage.jsp";
}else if(chose.equals("�
没有合适的资源?快使用搜索试试~ 我知道了~
毕业设计&课设--知心招聘源码,这是我的毕业设计,写得不好。.zip
共2000个文件
js:1236个
css:178个
html:148个
需积分: 5 0 下载量 191 浏览量
2024-02-20
00:23:55
上传
评论
收藏 35.24MB ZIP 举报
温馨提示
毕业设计&课设--知心招聘源码,这是我的毕业设计,写得不好。
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计&课设--知心招聘源码,这是我的毕业设计,写得不好。.zip (2000个子文件)
bootstrap.css 143KB
bootstrap.css 143KB
bootstrap.css 140KB
bootstrap.css 140KB
bootstrap.min.css 121KB
bootstrap.min.css 121KB
bootstrap.min.css 118KB
bootstrap.min.css 118KB
bootstrap.css 117KB
bootstrap.css 117KB
bootstrap.min.css 95KB
bootstrap.min.css 95KB
bootstrap-theme.css 26KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
bootstrap-theme.min.css 23KB
swiper.css 22KB
swiper.css 22KB
swiper.min.css 19KB
swiper.min.css 19KB
wangEditor.css 17KB
wangEditor.css 17KB
bootstrap-theme.css 16KB
bootstrap-theme.css 16KB
wangEditor.min.css 15KB
wangEditor.min.css 15KB
bootstrap-theme.min.css 15KB
bootstrap-theme.min.css 15KB
resume.css 15KB
resume.css 15KB
bootstrap-datetimepicker.css 12KB
bootstrap-datetimepicker.css 12KB
bootstrap-datetimepicker.min.css 11KB
bootstrap-datetimepicker.min.css 11KB
manageJob.css 7KB
manageJob.css 7KB
remodal-default-theme.css 6KB
remodal-default-theme.css 6KB
homePageSearchBox.css 5KB
searchBox.css 5KB
homePageSearchBox.css 5KB
searchBox.css 5KB
brower_resume.css 5KB
brower_resume.css 5KB
manage_news.css 5KB
manage_news.css 5KB
cropper.css 5KB
cropper.css 5KB
share.css 5KB
cropper.css 5KB
share.css 5KB
cropper.css 5KB
cropper.css 5KB
cropper.css 5KB
cropper.css 5KB
cropper.css 5KB
qunit.css 5KB
qunit.css 5KB
readArticle.css 4KB
readArticle.css 4KB
search_box.css 4KB
search_box.css 4KB
footer_one.css 4KB
footer_one.css 4KB
admin_list.css 4KB
admin_list.css 4KB
update_infor.css 4KB
update_infor.css 4KB
cropper.min.css 4KB
cropper.min.css 4KB
main.css 3KB
main.css 3KB
main.css 3KB
main.css 3KB
show_news.css 3KB
show_news.css 3KB
mangeCompInfor.css 3KB
mangeCompInfor.css 3KB
bussinessDetail.css 3KB
bussinessDetail.css 3KB
main.css 3KB
main.css 3KB
header_three.css 3KB
header_three.css 3KB
header_two.css 3KB
header_two.css 3KB
news_header.css 3KB
news_header.css 3KB
sidebar.css 3KB
sidebar.css 3KB
jobDetail.css 3KB
jobDetail.css 3KB
edit_news.css 3KB
edit_news.css 3KB
category_manage.css 3KB
category_manage.css 3KB
register.css 3KB
register.css 3KB
searchJob.css 3KB
searchJob.css 3KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Kwan的解忧杂货铺
- 粉丝: 2w+
- 资源: 3699
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- mysql-odbc-64-8.0.26
- 新建 Microsoft Word 文档 (2).docx
- 1652189183080063_42AD52629C553C7BC65694A425954A3F_1.apk
- 王都创世物语魔改版.apk
- Linear_regrassion_with_gradien_decent_example.ipynb
- 1719163625521533_1e90151d86c4cc2fadb97a0a82d0fc0e
- 虚拟现实课件-第五章 3物理建模
- 虚拟现实课件-第五章 2运动建模
- A1-ERP(资源协同)管理平台需求说明书.pdf
- 基于springboot+sureness的面向REST API资源无状态认证权限管理系统(源码+数据库+说明文档)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功