作者主页:编程指南针
简介:Java领域优质创作者、 Java项目、简历模板、学习资料、面试题库、技术互助
文末获取源码
项目编号:BS-PT-056
该项目是一个大学生校园兼职平台。该平台使用Java语言开发后台业务逻辑,运用了SpringMVC+Spring+MyBatis框架进行搭建,数据库服务器采用MySQL5.6对数据进行持久化。其主要功能有:兼职招聘、论坛交流、在线聊天、个人中心、信箱留言、登录注册等功能。
软件架构或技术说明:
后台:SpringMVC+Spring+MyBatis、mysql
前台:jquery、layui
部署环境:
1.服务器:tomcat8
2.运行环境:jdk1.8
3.数据库:mysql5.6/5.7
注意事项:
1.管理员登录页面链接在项目的页面最底部的版权,点击就好
2.管理员账号密码:10000/123456
下面展示部分功能图片:
网站端端首页:
兼职说明
论坛贴子
用户注册
登陆
个人中心
平台公告
发布兼职信息
与用户聊天
后台管理员登陆
用户管理
兼职管理
贴子管理
聊天管理
广告管理
信箱建议
收藏管理
轮播图管理
公告列表
系统设置
系统部分实现代码:
package com.work.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.work.common.utils.BaseUtil;
import com.work.common.utils.JsonUtil;
import com.work.common.utils.MD5Util;
import com.work.pojo.User;
import com.work.service.UserService;
@Controller
@RequestMapping("/server/user")
public class UserController extends BaseUtil{
@Autowired
private UserService userService;
//去用户列表
@RequestMapping("/goUserList")
public ModelAndView goUserList(ModelAndView mv){
mv.setViewName("server/userManage/userList");
return mv;
}
//获取用户列表
@RequestMapping("/getUserList")
public void getUserList(HttpServletResponse response,User user,Integer page,Integer limit){
if(page == null){
page = 1;
}
if(limit == null){
limit = 10;
}
Integer totalCount = userService.getUserListCount(user);
List list = userService.getUserList(user,(page-1) * limit, limit);
output(response,JsonUtil.buildJsonByTotalCount(list, totalCount));
}
//去添加用户
@RequestMapping("/goAddUser")
public ModelAndView goAddUser(ModelAndView mv){
mv.setViewName("server/userManage/addUser");
return mv;
}
//添加用户
@RequestMapping("/addUser")
public void addUser(HttpServletResponse response,User user){
user.setCreateTime(new Date());
user.setPassword(MD5Util.MD5Encode(user.getPassword(),"utf-8"));
userService.addUser(user);
output(response,JsonUtil.buildFalseJson(0, "添加成功!"));
}
//去编辑用户
@RequestMapping("/goUpdateUser")
public ModelAndView goUpdateUser(ModelAndView mv,Integer userId){
User user = userService.getUserById(userId);
mv.addObject("user", user);
mv.setViewName("server/userManage/updateUser");
return mv;
}
//编辑用户
@RequestMapping("/updateUser")
public void updateUser(HttpServletResponse response,User user){
userService.updateUser(user);
output(response,JsonUtil.buildFalseJson(0, "编辑成功!"));
}
//禁用用户
@RequestMapping("/deleteUser")
public void deleteUser(HttpServletResponse response,User user){
userService.updateUser(user);
output(response,JsonUtil.buildFalseJson(0, "禁用成功!"));
}
}
package com.work.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.work.common.utils.BaseUtil;
import com.work.common.utils.JsonUtil;
import com.work.pojo.Work;
import com.work.service.WorkService;
@Controller
@RequestMapping("/server/work")
public class WorkController extends BaseUtil{
@Autowired
private WorkService workService;
//去兼职列表
@RequestMapping("/goWorkList")
public ModelAndView goWorkList(ModelAndView mv){
mv.setViewName("server/workManage/workList");
return mv;
}
//获取兼职列表
@RequestMapping("/getWorkList")
public void getWorkList(HttpServletResponse response,Work work,Integer page,Integer limit){
if(page == null){
page = 1;
}
if(limit == null){
limit = 10;
}
int totalCount = workService.getWorkListCount(work);
List list = workService.getWorkList(work,(page-1) * limit, limit);
output(response,JsonUtil.buildJsonByTotalCount(list, totalCount));
}
//去编辑兼职
@RequestMapping("/goUpdateWork")
public ModelAndView goUpdateUser(ModelAndView mv,Integer id){
Work work = workService.getWorkById(id);
mv.addObject("work", work);
mv.setViewName("server/workManage/updateWork");
return mv;
}
//编辑兼职
@RequestMapping("/updateWork")
public void updateWork(HttpServletResponse response,Work work){
workService.updateWork(work);
output(response,JsonUtil.buildFalseJson(0, "编辑成功!"));
}
//禁用兼职
@RequestMapping("/deleteWork")
public void deleteUser(HttpServletResponse response,Work work){
workService.updateWork(work);
output(response,JsonUtil.buildFalseJson(0, "禁用成功!"));
}
}
package com.work.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.work.common.utils.BaseUtil;
import com.work.common.utils.JsonUtil;
import com.work.common.utils.MD5Util;
import com.work.pojo.SystemUpset;
import com.work.pojo.User;
import com.work.service.SystemUpsetService;
import com.work.service.UserService;
@Controller
@RequestMapping("/manage/login")
public class ManagerLoginController extends BaseUtil {
@Resource
private UserService userService;
@Resource
private SystemUpsetService systemUpsetService;
/**
* 管理后台登陆接口
*
* @param request
* @param response
* @param ga
*/
@RequestMapping("/dologin")
public void doLogin(HttpServletRequest request, HttpServletResponse response, User user) throws Exception {
User serverUser = (User) request.getSession().getAttribute("serverUser");
if(serverUser == null){
if(user.getUserId() == null){
output(response,JsonUtil.buildFalseJson(1,"账号不能为空"));
}else{
if(user.getPassword().equals("") || user.getPassword() == null){
output(response,JsonUtil.buildFalseJson(1,"密码不能为空"));
}else{
User userInfo = userService.getUserById(user.getUserId());
if(userInfo == null || userInfo.getUserLeven() != 1){
output(response,JsonUtil.buildFalseJson(1,"账号不正确或系统不存在该用户"));
}else{
if(!userInfo.getPassword().equals(MD5Util.MD5Encode(user.getPassword(),"utf-8"))){
output(response,JsonUtil.buildFalseJson(1,"您输入的密码不正确,请重试"));
}else{
//判断账号是否被禁用
if(userInfo.getIsEffect() != 1){
output(response,JsonUtil.buildFalseJson(1,"对不起您的账号已被禁用"));
}else{
//执行登陆后台的逻辑
request.getSession().setAttribute("serverUser",userInfo);
output(response, JsonUtil.buildFalseJson(0, "登陆成功,欢迎登录兼职平台管理系统"));
}
}
}
}
}
}else{
output(response, JsonUtil.buildFalseJson(0, "登陆成功,欢迎登录兼职平台管理系统"));
}
}
@RequestMapping("/goIndex")
public ModelAndView goHome(ModelAndView mv, HttpServletRequest request,SystemUpset systemUpset) {
User serverUser = (User) request.getSession().getAttribute("serverUser");
if (serverUser == null) { // 已退出
mv.setViewName("server/login");
} else {
List systems = systemUpsetService.getSystemUpsetList(systemUpset, 0, 10);
if(systems.size() > 0){
mv.addObject("system", systems.get(0));
}else{
mv.addObject("system", null);
}
mv.setViewName("server/index");
}
mv.addObject("serverUser", serverUser);
return mv;
}
@RequestMapping("/goServerLogin")
public ModelAndView goHome(ModelAndView mv) {
mv.setViewName("server/login");
return mv;
}
@RequestMapping("/goMain")
public ModelAndView goMain(ModelAndView mv, HttpServletRequest request) {
mv.setViewName("server/main");
return mv;
}
@RequestMapping("/dologout")
public void managerLogOut(ModelAndView modelView, HttpServletRequest request, HttpServletResponse response) {
request.getSession().invalidate();
output(response, JsonUtil.buildFalseJson(0, "退出成功"));
}
@RequestMapping("/goUpdatePassword")
public ModelAndView goUpdatePassword(HttpServletRequest request, ModelAndView mv) {
mv.setViewName("server/updatePwd");
return mv;
}
//修改密码
@RequestMapping("/updatePassword")
public void updatePassword(HttpServletRequest request,HttpServletResponse response,String rePassword, String password){
User serverUser = (User) request.getSession().getAttribute("serverUser");
User user = new User();
if(password.equals(rePassword)){
user.setUserId(serverUser.getUserId());
user.setPassword(MD5Util.MD5Encode(password,"utf-8"));
userService.updateUser(user);
request.getSession().invalidate();
output(response,JsonUtil.buildFalseJson(0, "修改密码成功"));
}else{
output(response,JsonUtil.buildFalseJson(1, "前后密码不一致"));
}
}
}
package com.work.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.work.common.utils.BaseUtil;
import com.work.common.utils.JsonUtil;
import com.work.pojo.Collect;
import com.work.service.CollectService;
@Controller
@RequestMapping("/server/collect")
public class CollectController extends BaseUtil{
@Autowired
private CollectService collectService;
//去收藏列表
@RequestMapping("/goCollectList")
public ModelAndView goCollectList(ModelAndView mv){
mv.setViewName("server/collectManage/collectList");
return mv;
}
//获取收藏列表
@RequestMapping("/getCollectList")
public void getCollectList(HttpServletResponse response,Collect collect,Integer page,Integer limit){
if(page == null){
page = 1;
}
if(limit == null){
limit = 10;
}
int totalCount = collectService.getCollectListCount(collect);
List list = collectService.getCollectList(collect,(page-1) * limit, limit);
output(response,JsonUtil.buildJsonByTotalCount(list, totalCount));
}
//删除收藏
@RequestMapping("/deleteCollect")
public void deleteCollect(HttpServletResponse response,Integer id){
collectService.deleteCollectById(id);
output(response,JsonUtil.buildFalseJson(0, "删除成功!"));
}
}
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net