作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
企业用户包含以下功能:
企业用户登录界面,招聘信息查看,发布招聘信息,招聘信息列表,查看某个简历的投递情况等功能。
用户包含以下功能:
用户登录后,用户查看公司,投递简历,查看公告页面,用户修改信息,查看用户投递记录等功能。
管理员包含以下功能:
管理员登录页面,管理员首页,操作会员页面,操作用人单位页面,管理招聘信息,管理新闻,管理公告等功能。
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
环境需要
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.数据库:MySql 5.7版本;
6.是否Maven项目:否;
技术栈
1. 后端:mysql+Spring+hibernate+Struts 2
2. 前端:HTML+CSS+JavaScript+jsp
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
运行截图
管理端页面
相关代码
登录管理控制器
@Controller("loginAction")
@Scope("prototype")
public class LoginAction extends ActionSupport {
//============依赖注入start================
@Autowired
private ManageService manageService;//管理
@Autowired
private UserService userService;//用户
@Autowired
private SpService spService;
//===========依赖注入end==================
//-------------------------华丽分割线---------------------------------------------
//============自定义参数start=============
private Integer role;
private Integer type;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
private String userName;//用户名
private String passWord;//密码
private String realName;
private String phone;//手机
//============自定义参数end=============
//-------------------------华丽分割线---------------------------------------------
public String getRealName() {
return realName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassWord() {
return passWord;
}
public void setPassWord(String passWord) {
this.passWord = passWord;
}
//============文件上传start=============
private File file;
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//============文件上传end=============
//-------------------------华丽分割线---------------------------------------------
public String login() {
return "login";
}
public String uIndex() {
Map<String,Object> alias = new HashMap<String,Object>();
StringBuffer sb = new StringBuffer();
sb = sb.append("from Sp where 1=1 and isDelelet = 0 ");
if(type !=null){
sb.append(" and type = :realName ");
alias.put("realName", type);
}
sb = sb.append("order by id desc");
List<Sp> pagers = spService.listByAlias(sb.toString(),alias);
ActionContext.getContext().put("pagers", pagers);
List<Sp> listByAlias = spService.listByAlias("from Sp where 1=1 and isDelelet = 0 order by id desc",null);
if (listByAlias !=null && listByAlias.size()>0 && listByAlias.size() >=5){
listByAlias = listByAlias.subList(0, 5);
}
ActionContext.getContext().put("news", listByAlias);
return "success";
}
//用户登陆
public String ulogin() {
return "success";
}
public String home() {
return "success";
}
public String tores() {
User m = new User();
m.setPassWord(passWord);
m.setPhone(phone);
m.setRealName(realName);
m.setUserName(userName);
userService.save(m);
ActionContext.getContext().put("url", "/login_ulogin.do");
return "redirect";
}
//注册
public String res(){
return "success";
}
//用户登陆
public String utlogin(){
String hql = "from User where userName = :userName and passWord = :passWord";
Map<String,Object> alias = new HashMap<String,Object>();
alias.put("userName",userName);
alias.put("passWord", passWord);
List<User> manageList=userService.getByHQL(hql, alias);
if(manageList.size()>0){
//将用户信息放入session
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("userName", manageList.get(0).getRealName());
session.setAttribute("userId",manageList.get(0).getId() );
session.setAttribute("manage", manageList.get(0));
session.setAttribute("roleId", role);
ActionContext.getContext().put("url", "/login_uIndex.do");
return "redirect";
}else{
ActionContext.getContext().put("url", "/login_ulogin.do");
return "redirect";
}
}
//登录
public String toLogin(){
String hql = "from Manage where name = :userName and passWord = :passWord and type = :type";
Map<String,Object> alias = new HashMap<String,Object>();
alias.put("userName",userName);
alias.put("passWord", passWord);
alias.put("type", type);
List<Manage> manageList=manageService.getByHQL(hql, alias);
if(manageList.size()>0){
//将用户信息放入session
HttpSession session = ServletActionContext.getRequest()
.getSession();
session.setAttribute("role", manageList.get(0).getType());
session.setAttribute("userName", manageList.get(0).getRealName());
session.setAttribute("userId",manageList.get(0).getId() );
session.setAttribute("manage", manageList.get(0));
session.setAttribute("roleId", role);
return "index";
}else{
return "login";
}
}
//退出
public String tuichu() {
ActionContext ac = ActionContext.getContext();
Map session = ac.getSession();
session.remove("userName");
session.remove("userId");
return "login";
}
public String utc() {
ActionContext ac = ActionContext.getContext();
Map session = ac.getSession();
session.remove("userName");
session.remove("userId");
ActionContext.getContext().put("url", "/login_ulogin.do");
return "redirect";
}
}
管理控制器
Controller("manageAction")
@Scope("prototype")
public class ManageAction extends ActionSupport implements ModelDriven<Manage>{
private Manage manage;
@Autowired
private UserService userService;
@Autowired
private ManageService manageService;
private int userId;
private String userName;
private int sayId;
/**
* 登陆以后进入首页
* @return
*/
public String index(){
Manage ma = manageService.login(manage);
if(ma == null){
return "login";
}
HttpSession session = ServletActionContext.getRequest().getSession();
session.setAttribute("userName", ma.getName());
session.setAttribute("userIdLogo", ma.getId());
session.setAttribute("userType", ma.getType());
session.setAttribute("userId", ma.getType());
return "index";
}
/**
* 跳到管理员页面,并且顺带查询管理员列表分页
* @return
*/
public String manage(){
Pager<Manage> pagers = manageService.list(manage);
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("Obj", manage);
return SUCCESS;
}
/**
* 跳转添加页面
* @return
*/
public String addManage(){
return SUCCESS;
}
/**
* 添加
* @return
* @throws IOException
*/
public void manageAdd() throws IOException{
HttpServletResponse resp = ServletActionContext.getResponse();
resp.setContentType("application/json;charset=UTF-8");
PrintWriter out = null;
manage.setType(2);
manageService.save(manage);
out = resp.getWriter();
out.write(JSONArray.fromObject(1).toString());
}
/**
*
* @return
*/
public String manageEdit(){
Manage ma = manageService.getById(manage.getId());
ActionContext.getContext().put("ma", ma);
return SUCCESS;
}
public String manageEdit2(){
Manage ma = manageService.getById(manage.getId());
ActionContext.getContext().put("ma", ma);
return SUCCESS;
}
public void editmanage() throws IOException{
HttpServletResponse resp = ServletActionContext.getResponse();
resp.setContentType("application/json;charset=UTF-8");
PrintWriter out = null;
//Manage ma = manageService.getById(manage.getId());
/*ma.setPassWord(manage.getPassWord());
ma.setRealName(manage.getRealName());
ma.setName(manage.getName());
ma.setId(manage.getId());*/
manageService.updateInfo(manage);
out = resp.getWriter();
out.write(JSONArray.fromObject(1).toString());
}
public String delManage(){
manageService.deleteInfo(manage.getId());
ActionContext.getContext().put("url", "/manage_manage.do");
return "redirect";
}
//=============================================================================================================
public int getSayId() {
return sayId;
}
public void setSayId(int sayId) {
this.sayId = sayId;
}
private File file;
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
public String getFileFileName() {
return fileFileName;
}
public void setFileFileName(String fileFileName) {
this.fileFileName = fileFileName;
}
public String getFileContentType() {
return fileContentType;
}
public void setFileContentType(String fileContentType) {
this.fileContentType = fileContentType;
}
//提交过来的file的名字
private String fileFileName;
//提交过来的file的MIME类型
private String fileContentType;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public Manage getModel() {
if(manage==null) manage = new Manage();
return manage;
}
/**
* 获取用户列表
* @return
*/
public String userList(){
Pager<User> pagers = userService.listAll(userName);
//这里需要对等级进行遍历
/*List<Grade> list = gradeService.list();
if(pagers != null && pagers.getDatas() != null && pagers.getDatas().size()>0){
for(User u : pagers.getDatas()){
//对这里的人 进行遍历
for(Grade g: list){
if(u.getJifen()>=g.getStartMin() && u.getJifen() <=g.getEndMax()){
u.setDengji(g.getName());
}
}
}
}*/
ActionContext.getContext().put("pagers", pagers);
ActionContext.getContext().put("userName1", userName);
return SUCCESS;
}
/**
* 根据用户id查询所有图片
* @return
*/
/*public String userPhotos(){
Pager<SayMood> pagers = sayMoodService.findAllphotosById(userId);
ActionContext.getContext().put("pagers", pagers);
return SUCCESS;
}
*/
/**
* 删除照片
* @return
*/
/*public String delsay(){
sayMoodService.del(sayId);
ActionContext.getContext().put("url", "/manage_userPhotos.do");
return "redirect";
}*/
//删除用户
public String delUse(){
userService.delUse(userId);
ActionContext.getContext().put("url", "/manage_userList.do");
return "redirect";
}
/**
* 图片上传
* @return
* @throws Exception
*/
/*public String fileUpload() throws Exception{
HttpSession session = ServletActionContext.getRequest().getSession();
if(session.getAttribute("userId") != null){
int userId = Integer.parseInt( session.getAttribute("userId").toString());
String root = ServletActionContext.getServletContext().getRealPath("/")+"upload";
//String root = ServletActionContext.getServletContext().getRealPath("upload");
//String root = ServletActionContext.getRequest().getContextPath()+"/"+"upload";
InputStream is = new FileInputStream(file);
fileFileName = UUIDUtils.create()+fileFileName;
OutputStream os = new FileOutputStream(new File(root, fileFileName));
System.out.println("fileFileName: " + fileFileName);
System.out.println("file: " + file.getName());
System.out.println("file: " + file.getPath());
byte[] buffer = new byte[500];
int length = 0;
while(-1 != (length = is.read(buffer, 0, buffer.length)))
{
os.write(buffer);
}
os.close();
is.close();
//接下来存到说说表中
SayMood sayMood = new SayMood();
sayMood.setContent("\\upload\\"+fileFileName);
sayMood.setCreateTime(new Date());
sayMood.setDzs(0);
sayMood.setIsDelete(2);
sayMood.setType(2);
User u = userService.getUser(userId);
sayMood.setSayUser(u);
sayMoodService.save(sayMood);
*//**
* 积分规则还没有做。上传图片需要加积分
*//*
//上传完毕,跳转列表action
ActionContext.getContext().put("url", "/user_homePage.do");
return "redirect";
}else{
return "login";
}
}*/
public String report(){
return SUCCESS;
}
//下面进行报表
/**
* 查询上个月和这个月 账号注册
* @throws IOException
*/
public void reportUser() throws IOException{
HttpServletResponse resp = ServletActionContext.getResponse();
resp.setContentType("application/json;charset=UTF-8");
PrintWriter out = null;
//首先查询本月和上个月用户总人数
List<User> users = userService.findSYuser();
List<User> users2 = userService.findBYuser();
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("NAME", getsy());
if(users != null && users.size()>0){
map1.put("TOTAL", users.size());
}else{
map1.put("TOTAL", 0);
}
Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("NAME", getBy());
if(users2 != null && users2.size()>0){
map2.put("TOTAL", users2.size());
}else{
map2.put("TOTAL", 0);
}
list.add(map1);
list.add(map2);
//创建Option
GsonOption option = new GsonOption();
option.title("注册人数").tooltip(Trigger.axis).legend("数量(人)");
//横轴为值轴
option.xAxis(new ValueAxis().boundaryGap(0d, 0.01));
//创建类目轴
CategoryAxis category = new CategoryAxis();
//柱状数据
Bar bar = new Bar("月份");
//饼图数据
Pie pie = new Pie("月份");
//循环数据
for (Map<String, Object> objectMap : list) {
//设置类目
category.data(objectMap.get("NAME"));
//类目对应的柱状图
bar.data(objectMap.get("TOTAL"));
//饼图数据
pie.data(new PieData(objectMap.get("NAME").toString(), objectMap.get("TOTAL")));
}
//设置类目轴
option.yAxis(category);
//饼图的圆心和半径
pie.center(900,380).radius(100);
//设置数据
option.series(bar, pie);
//由于药品名字过长,图表距离左侧距离设置180,关于grid可以看ECharts的官方文档
option.grid().x(180);
//返回Option
out = resp.getWriter();
out.write(option.toString());
}
public String getBy(){
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -0);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
String time = format.format(c.getTime());
System.out.println(time);
return time;
}
public String getsy(){
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -1);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
String time = format.format(c.getTime());
System.out.println(time);
return time;
}
public void reportSay() throws IOException{/*
HttpServletResponse resp = ServletActionContext.getResponse();
resp.setContentType("application/json;charset=UTF-8");
PrintWriter out = null;
//首先查询本月和上个月用户总人数
List<SayMood> users = sayMoodService.findSYusay();
List<SayMood> users2 = sayMoodService.findBYsay();
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("NAME", getsy());
if(users != null && users.size()>0){
map1.put("TOTAL", users.size());
}else{
map1.put("TOTAL", 0);
}
Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("NAME", getBy());
if(users2 != null && users2.size()>0){
map2.put("TOTAL", users2.size());
}else{
map2.put("TOTAL", 0);
}
list.add(map1);
list.add(map2);
//创建Option
GsonOption option = new GsonOption();
option.title("发表图片数").tooltip(Trigger.axis).legend("数量(人)");
//横轴为值轴
option.xAxis(new ValueAxis().boundaryGap(0d, 0.01));
//创建类目轴
CategoryAxis category = new CategoryAxis();
//柱状数据
Bar bar = new Bar("月份");
//饼图数据
Pie pie = new Pie("月份");
//循环数据
for (Map<String, Object> objectMap : list) {
//设置类目
category.data(objectMap.get("NAME"));
//类目对应的柱状图
bar.data(objectMap.get("TOTAL"));
//饼图数据
pie.data(new PieData(objectMap.get("NAME").toString(), objectMap.get("TOTAL")));
}
//设置类目轴
option.yAxis(category);
//饼图的圆心和半径
pie.center(900,380).radius(100);
//设置数据
option.series(bar, pie);
//由于药品名字过长,图表距离左侧距离设置180,关于grid可以看ECharts的官方文档
option.grid().x(180);
//返回Option
out = resp.getWriter();
out.write(option.toString());
*/}
public String welcome(){
return SUCCESS;
}
}
如果也想学习本系统,下面领取。关注并回复:031ssh