Compare commits
3 Commits
feature-lo
...
3ab267754c
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ab267754c | |||
| 8d72241618 | |||
| dcab19a765 |
@@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-12-15 11:11:21
|
* @Date: 2022-12-15 11:11:21
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-11 09:18:29
|
* @LastEditTime: 2023-01-13 10:08:04
|
||||||
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\account\P13AccountCheckController.java
|
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\account\P13AccountCheckController.java
|
||||||
* @Description: P13账号验证用Controller。
|
* @Description: P13账号验证用Controller。
|
||||||
*
|
*
|
||||||
@@ -25,15 +25,21 @@ import com.cpic.xim.myutils.account.CpicXIMStaffInfo;
|
|||||||
import com.cpic.xim.myutils.account.LdapAccountCheck;
|
import com.cpic.xim.myutils.account.LdapAccountCheck;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping( path = "/account" )
|
@RequestMapping( path = "/account")
|
||||||
@SuppressWarnings( "unused" )
|
@SuppressWarnings( "unused")
|
||||||
public class P13AccountCheckController
|
public class P13AccountCheckController
|
||||||
{
|
{
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
*
|
* 根据用户提供的P09工号或者P13账号密码,查找用户信息,并AD域服务器验证p13账号密码。
|
||||||
|
* 验证通过即返回人员信息。
|
||||||
|
* 验证不通过result.success值为false,并在message提供失败原因。
|
||||||
|
* @param param 由json格式转换的请求参数
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return 返回一个P13AccountCheckResult对象,其中提供验证结果
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping( path = "/p13_account_check.do" )
|
@RequestMapping( path = "/p13_account_check.do")
|
||||||
public P13AccountCheckResult checkP13Account( @RequestBody P13AccountCheckRequest param,
|
public P13AccountCheckResult checkP13Account( @RequestBody P13AccountCheckRequest param,
|
||||||
HttpServletRequest request, HttpServletResponse response )
|
HttpServletRequest request, HttpServletResponse response )
|
||||||
throws IllegalSelectorException, IOException
|
throws IllegalSelectorException, IOException
|
||||||
@@ -54,7 +60,6 @@ public class P13AccountCheckController
|
|||||||
staff = null;
|
staff = null;
|
||||||
result.setMessage( "人员工号或P13账号不存在!" );
|
result.setMessage( "人员工号或P13账号不存在!" );
|
||||||
result.setSuccess( false );
|
result.setSuccess( false );
|
||||||
|
|
||||||
}
|
}
|
||||||
catch ( ClassNotFoundException error )
|
catch ( ClassNotFoundException error )
|
||||||
{
|
{
|
||||||
@@ -64,7 +69,7 @@ public class P13AccountCheckController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询结果是null,说明没有查询到结果,工号或p13账号不存在,返回结果。
|
// 查询结果是null,说明没有查询到结果,工号或p13账号不存在,返回结果。
|
||||||
if ( staff == null )
|
if ( staff == null)
|
||||||
{
|
{
|
||||||
result.setMessage( "人员工号或P13账号不存在!" );
|
result.setMessage( "人员工号或P13账号不存在!" );
|
||||||
result.setSuccess( false );
|
result.setSuccess( false );
|
||||||
@@ -73,7 +78,7 @@ public class P13AccountCheckController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 判断一下p13是否存在,如果不存在就结束过程
|
// 判断一下p13是否存在,如果不存在就结束过程
|
||||||
if ( staff.getP13UID().isEmpty() == true )
|
if ( staff.getP13UID().isEmpty() == true)
|
||||||
{
|
{
|
||||||
result.setMessage( "P13账号不存在,请联系信息技术部申请账号!" );
|
result.setMessage( "P13账号不存在,请联系信息技术部申请账号!" );
|
||||||
result.setSuccess( false );
|
result.setSuccess( false );
|
||||||
@@ -85,7 +90,7 @@ public class P13AccountCheckController
|
|||||||
boolean ldapCheckResult =
|
boolean ldapCheckResult =
|
||||||
LdapAccountCheck.ldapLogin( staff.getP13UID(), param.getPassword() );
|
LdapAccountCheck.ldapLogin( staff.getP13UID(), param.getPassword() );
|
||||||
|
|
||||||
if ( ldapCheckResult == true )
|
if ( ldapCheckResult == true)
|
||||||
{
|
{
|
||||||
result.setSuccess( true );
|
result.setSuccess( true );
|
||||||
result.setMessage( "验证成功!" );
|
result.setMessage( "验证成功!" );
|
||||||
@@ -95,8 +100,7 @@ public class P13AccountCheckController
|
|||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
|
|
||||||
session.setAttribute( "staff_info", staff );
|
session.setAttribute( "staff_info", staff );
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
result.setSuccess( false );
|
result.setSuccess( false );
|
||||||
result.setMessage( "密码错误!" );
|
result.setMessage( "密码错误!" );
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-01-12 15:01:22
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @LastEditTime: 2023-01-13 09:23:55
|
||||||
|
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\filters\token\TokenFilter.java
|
||||||
|
* @Description: 用于检查token的过滤器
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
package com.cpic.xim.web.filters.token;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.Filter;
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@SuppressWarnings( "unused")
|
||||||
|
public class TokenFilter implements Filter
|
||||||
|
{
|
||||||
|
/*****************************************************
|
||||||
|
*
|
||||||
|
*****************************************************/
|
||||||
|
@Override
|
||||||
|
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain )
|
||||||
|
throws ServletException, IOException
|
||||||
|
{
|
||||||
|
HttpServletRequest request = (HttpServletRequest) req;
|
||||||
|
HttpServletResponse response = (HttpServletResponse) resp;
|
||||||
|
|
||||||
|
String URI = request.getRequestURI();
|
||||||
|
|
||||||
|
chain.doFilter( request, response );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
|
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||||
|
version="3.1">
|
||||||
<display-name>Archetype Created Web Application</display-name>
|
<display-name>Archetype Created Web Application</display-name>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
@@ -24,6 +27,15 @@
|
|||||||
<url-pattern>*.do</url-pattern>
|
<url-pattern>*.do</url-pattern>
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<filter-name>token-filter</filter-name>
|
||||||
|
<filter-class>com.cpic.xim.web.filters.token.TokenFilter</filter-class>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>token-filter</filter-name>
|
||||||
|
<url-pattern>*.do</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
<!-- 配置文件路径参数 -->
|
<!-- 配置文件路径参数 -->
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>config_file_location</param-name>
|
<param-name>config_file_location</param-name>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-12-14 15:12:46
|
* @Date: 2022-12-14 15:12:46
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-11 10:28:24
|
* @LastEditTime: 2023-01-12 14:52:09
|
||||||
* @FilePath: \admin_system\src\router\index.js
|
* @FilePath: \admin_system\src\router\index.js
|
||||||
* @Description: 定义应用路由配置
|
* @Description: 定义应用路由配置
|
||||||
*
|
*
|
||||||
@@ -62,6 +62,15 @@ const routes = [
|
|||||||
icon: "edit",
|
icon: "edit",
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: "/staffInfo",
|
||||||
|
name: "StaffInfo",
|
||||||
|
meta: {
|
||||||
|
title: "人员信息",
|
||||||
|
icon: "edit",
|
||||||
|
},
|
||||||
|
component: () => import("../views/info/StaffInfo.vue"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/newsIndex",
|
path: "/newsIndex",
|
||||||
name: "NewsIndex",
|
name: "NewsIndex",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-12-22 09:10:20
|
* @Date: 2022-12-22 09:10:20
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-11 17:02:15
|
* @LastEditTime: 2023-01-12 17:47:36
|
||||||
* @FilePath: \admin_system\src\utils\api\info\account.js
|
* @FilePath: \admin_system\src\utils\api\info\account.js
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@@ -13,11 +13,13 @@ import { API_URL } from "@/utils/api/config"; //所有API的地址
|
|||||||
import router from "../../../router/index";
|
import router from "../../../router/index";
|
||||||
import store from "../../../store/index";
|
import store from "../../../store/index";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录请求函数
|
||||||
|
* @param {*} userInfo
|
||||||
|
* @returns 返回promise对象
|
||||||
|
*/
|
||||||
export function Login(userInfo)
|
export function Login(userInfo)
|
||||||
{
|
{
|
||||||
//debugger;
|
|
||||||
console.log(API_URL.URL_LOGIN);
|
|
||||||
|
|
||||||
return instance.request(
|
return instance.request(
|
||||||
{
|
{
|
||||||
method: "post",
|
method: "post",
|
||||||
@@ -27,6 +29,7 @@ export function Login(userInfo)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function Logout()
|
export function Logout()
|
||||||
{
|
{
|
||||||
// if (this.$store && this.$store.state.app)
|
// if (this.$store && this.$store.state.app)
|
||||||
|
|||||||
@@ -2,14 +2,16 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-12-22 17:18:10
|
* @Date: 2022-12-22 17:18:10
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-11 14:58:44
|
* @LastEditTime: 2023-01-12 17:47:39
|
||||||
* @FilePath: \admin_system\src\utils\api\request.js
|
* @FilePath: \admin_system\src\utils\api\request.js
|
||||||
* @Description:
|
* @Description: 配置axios拦截器
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import store from "../../store/index";
|
import store from "../../store/index";
|
||||||
|
import { ElMessageBox } from "element-plus";
|
||||||
|
import router from "@/router";
|
||||||
|
|
||||||
const service = axios.create(
|
const service = axios.create(
|
||||||
{
|
{
|
||||||
@@ -18,7 +20,10 @@ const service = axios.create(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//加上请求拦截器
|
|
||||||
|
/**
|
||||||
|
* 加上请求拦截器
|
||||||
|
*/
|
||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
function (config)
|
function (config)
|
||||||
{
|
{
|
||||||
@@ -47,13 +52,42 @@ service.interceptors.request.use(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//响应拦截器
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
function (response)
|
function (response)
|
||||||
{
|
{
|
||||||
|
//200
|
||||||
|
if (response.status === 200)
|
||||||
|
{
|
||||||
|
console.log("响应拦截器,响应代码", response.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
//401,用户token失效,跳转到
|
||||||
|
if (response.state === 401)
|
||||||
|
{
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
"用户登录超时,请重新登录",
|
||||||
|
"警告",
|
||||||
|
{
|
||||||
|
confirmButtonText: "是",
|
||||||
|
cancelButtonText: "否",
|
||||||
|
type: "warning",
|
||||||
|
},
|
||||||
|
).then(() =>
|
||||||
|
{
|
||||||
|
router.replace("/login");
|
||||||
|
}).catch(() =>
|
||||||
|
{
|
||||||
|
router.replace("/login");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
function (error)
|
function (error)
|
||||||
{
|
{
|
||||||
|
console.log("响应拦截器,异常信息:", error);
|
||||||
|
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-12-14 15:23:54
|
* @Date: 2022-12-14 15:23:54
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-11 14:40:11
|
* @LastEditTime: 2023-01-13 09:35:07
|
||||||
* @FilePath: \admin_system\src\views\account\Login.vue
|
* @FilePath: \admin_system\src\views\account\Login.vue
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@@ -35,10 +35,10 @@
|
|||||||
<label class="form-label">验证码</label>
|
<label class="form-label">验证码</label>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :span="14">
|
<el-col :span="14">
|
||||||
<el-input type="text"></el-input>
|
<el-input type="text" disabled></el-input>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<el-button type="danger" class="el-button-block" @click="getValidateCode()">获取验证码</el-button>
|
<el-button type="danger" disabled class="el-button-block" @click="getValidateCode()">获取验证码</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
63
企业级管理系统/web/admin_system/src/views/info/StaffInfo.vue
Normal file
63
企业级管理系统/web/admin_system/src/views/info/StaffInfo.vue
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-01-12 14:43:46
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @LastEditTime: 2023-01-13 16:53:55
|
||||||
|
* @FilePath: \admin_system\src\views\info\StaffInfo.vue
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="query_box">
|
||||||
|
<el-form inline="true">
|
||||||
|
<el-form-item label="员工工号或P13账号:">
|
||||||
|
<el-row :gutter="10" class="el-row">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-input v-model="query_param.staff_code"></el-input>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-button type="danger">查询</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "staff-info",
|
||||||
|
data()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
query_param: {
|
||||||
|
staff_code: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.el-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-label {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.query_box {
|
||||||
|
width: 600px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.query_box:hover {
|
||||||
|
box-shadow: 0px 0px 3px 3px #cccccc;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user