Java职称评审管理系统
项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。
项目技术:
Springboot + mybatis + Maven + Vue 等等组成,B/S模式 + Maven管理等等。
环境需要
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/8.0等版本均可;
技术栈
后端:Springboot mybatis
前端:vue+css+javascript+jQuery+easyUI+highcharts
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
3.管理员账号:abo 密码:abo
4.开发环境为Eclipse/idea,数据库为mysql 使用java语言开发。
5.运行SpringbootSchemaApplication.java 即可打开首页
6.数据库连接src\main\resources\application.yml中修改
7.maven包版本apache-maven-3.3.9.
8.后台路径地址:localhost:8080/项目名称/admin
package com.interceptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.http.HttpStatus;
import com.annotation.IgnoreAuth;
import com.entity.EIException;
import com.entity.TokenEntity;
import com.service.TokenService;
import com.utils.R;
/**
* 权限(Token)验证
*/
@Component
public class AuthorizationInterceptor implements HandlerInterceptor {
public static final String LOGIN_TOKEN_KEY = "Token";
@Autowired
private TokenService tokenService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//支持跨域请求
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
// 跨域时会首先发送一个OPTIONS请求,这里我们给OPTIONS请求直接返回正常状态
if (request.getMethod().equals(RequestMethod.OPTIONS.name())) {
response.setStatus(HttpStatus.OK.value());
return false;
}
IgnoreAuth annotation;
if (handler instanceof HandlerMethod) {
annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);
} else {
return true;
}
//从header中获取token
String token = request.getHeader(LOGIN_TOKEN_KEY);
/**
* 不需要验证权限的方法直接放过
*/
if(annotation!=null) {
return true;
}
TokenEntity tokenEntity = null;
if(StringUtils.isNotBlank(token)) {
tokenEntity = tokenService.getTokenEntity(token);
}
if(tokenEntity != null) {
request.getSession().setAttribute("userId", tokenEntity.getUserid());
request.getSession().setAttribute("role", tokenEntity.getRole());
request.getSession().setAttribute("tableName", tokenEntity.getTablename());
request.getSession().setAttribute("username", tokenEntity.getUsername());
return true;
}
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
try {
writer = response.getWriter();
writer.print(JSONObject.toJSONString(R.error(401, "请先登录")));
} finally {
if(writer != null){
writer.close();
}
}
// throw new EIException("请先登录", 401);
return false;
}
}
import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
import forum from '@/views/modules/forum/list'
import news from '@/views/modules/news/list'
import shengfen from '@/views/modules/shengfen/list'
import jieguogongbu from '@/views/modules/jieguogongbu/list'
import pingshenyuan from '@/views/modules/pingshenyuan/list'
import yonghu from '@/views/modules/yonghu/list'
import chat from '@/views/modules/chat/list'
import pingshentiaojian from '@/views/modules/pingshentiaojian/list'
import storeup from '@/views/modules/storeup/list'
import config from '@/views/modules/config/list'
import discusspingshentiaojian from '@/views/modules/discusspingshentiaojian/list'
import zhichengshenqing from '@/views/modules/zhichengshenqing/list'
//2.配置路由 注意:名字
const routes = [{
path: '/index',
name: '首页',
component: Index,
children: [{
// 这里不设置值,是把main作为默认页面
path: '/',
name: '首页',
component: Home,
meta: {icon:'', title:'center'}
}, {
path: '/updatePassword',
name: '修改密码',
component: UpdatePassword,
meta: {icon:'', title:'updatePassword'}
}, {
path: '/pay',
name: '支付',
component: pay,
meta: {icon:'', title:'pay'}
}, {
path: '/center',
name: '个人信息',
component: center,
meta: {icon:'', title:'center'}
}
,{
path: '/forum',
name: '论坛管理',
component: forum
}
,{
path: '/news',
name: '系统公告',
component: news
}
,{
path: '/shengfen',
name: '省份',
component: shengfen
}
,{
path: '/jieguogongbu',
name: '结果公布',
component: jieguogongbu
}
,{
path: '/pingshenyuan',
name: '评审员',
component: pingshenyuan
}
,{
path: '/yonghu',
name: '用户',
component: yonghu
}
,{
path: '/chat',
name: '客服管理',
component: chat
}
,{
path: '/pingshentiaojian',
name: '评审条件',
component: pingshentiaojian
}
,{
path: '/storeup',
name: '我的收藏管理',
component: storeup
}
,{
path: '/config',
name: '轮播图管理',
component: config
}
,{
path: '/discusspingshentiaojian',
name: '评审条件评论',
component: discusspingshentiaojian
}
,{
path: '/zhichengshenqing',
name: '职称申请',
component: zhichengshenqing
}
]
},
{
path: '/login',
name: 'login',
component: Login,
meta: {icon:'', title:'login'}
},
{
path: '/register',
name: 'register',
component: register,
meta: {icon:'', title:'register'}
},
{
path: '/',
name: '首页',
redirect: '/index'
}, /*默认跳转路由*/
{
path: '*',
component: NotFound
}
]
//3.实例化VueRouter 注意:名字
const router = new VueRouter({
mode: 'hash',
/*hash模式改为history*/
routes // (缩写)相当于 routes: routes
})
export default router;