This commit is contained in:
xd 2024-05-16 16:12:15 +08:00
parent a40d03899f
commit 17720a24bc
9 changed files with 123 additions and 22 deletions

View File

@ -79,7 +79,7 @@ public class SysSapUserController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SysSapUser sysSapUser) public AjaxResult add(@RequestBody SysSapUser sysSapUser)
{ {
sysSapUser.setSapUserId(UUID.fastUUID().toString()); //sysSapUser.setSapUserId(UUID.fastUUID().toString());
return toAjax(sysSapUserService.insertSysSapUser(sysSapUser)); return toAjax(sysSapUserService.insertSysSapUser(sysSapUser));
} }

View File

@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import com.ruoyi.web.utils.SHA1;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -62,6 +63,20 @@ public class SysUserController extends BaseController
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
/**
* 获取切换账号的OA登录 token
*/
@PreAuthorize("@ss.hasPermi('system:user:OAtoken')")
@GetMapping("/getSwitchAccountToken/{account}")
public AjaxResult getSwitchAccountToken(@PathVariable("account") String account)
{
AjaxResult ajax = AjaxResult.success();
//OA验证
String newToken = SHA1.shaEncode("uy4MbH"+account);
ajax.put("token", newToken);
return ajax;
}
/** /**
* 获取用户列表 * 获取用户列表
*/ */

View File

@ -30,4 +30,8 @@ public class SHA1 {
return ""; return "";
} }
} }
public static void main(String[] args) {
System.out.println(shaEncode("uy4MbH"+"8879"));
}
} }

View File

@ -34,6 +34,10 @@ public class SysSapUser extends BaseEntity
@Excel(name = "系统账户名称") @Excel(name = "系统账户名称")
private String sysUserNickName; private String sysUserNickName;
/** 片区 */
@Excel(name = "片区")
private String sysUserPianqu;
public void setSapUserId(String sapUserId) public void setSapUserId(String sapUserId)
{ {
this.sapUserId = sapUserId; this.sapUserId = sapUserId;
@ -80,6 +84,10 @@ public class SysSapUser extends BaseEntity
return sysUserNickName; return sysUserNickName;
} }
public String getSysUserPianqu() { return sysUserPianqu; }
public void setSysUserPianqu(String sysUserPianqu) { this.sysUserPianqu = sysUserPianqu; }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -10,10 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sapUserName" column="sap_user_name" /> <result property="sapUserName" column="sap_user_name" />
<result property="sysUserName" column="sys_user_name" /> <result property="sysUserName" column="sys_user_name" />
<result property="sysUserNickName" column="sys_user_nick_name" /> <result property="sysUserNickName" column="sys_user_nick_name" />
<result property="sysUserPianqu" column="sys_user_pianqu" />
</resultMap> </resultMap>
<sql id="selectSysSapUserVo"> <sql id="selectSysSapUserVo">
select sap_user_id, sap_user_bm, sap_user_name, sys_user_name, sys_user_nick_name from sys_sap_user select sap_user_id, sap_user_bm, sap_user_name, sys_user_name, sys_user_nick_name, sys_user_pianqu from sys_sap_user
</sql> </sql>
<select id="selectSysSapUserList" parameterType="SysSapUser" resultMap="SysSapUserResult"> <select id="selectSysSapUserList" parameterType="SysSapUser" resultMap="SysSapUserResult">
@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sapUserName != null and sapUserName != ''">sap_user_name,</if> <if test="sapUserName != null and sapUserName != ''">sap_user_name,</if>
<if test="sysUserName != null and sysUserName != ''">sys_user_name,</if> <if test="sysUserName != null and sysUserName != ''">sys_user_name,</if>
<if test="sysUserNickName != null and sysUserNickName != ''">sys_user_nick_name,</if> <if test="sysUserNickName != null and sysUserNickName != ''">sys_user_nick_name,</if>
<if test="sysUserPianqu != null and sysUserPianqu != ''">sys_user_pianqu,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sapUserId != null">#{sapUserId},</if> <if test="sapUserId != null">#{sapUserId},</if>
@ -46,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sapUserName != null and sapUserName != ''">#{sapUserName},</if> <if test="sapUserName != null and sapUserName != ''">#{sapUserName},</if>
<if test="sysUserName != null and sysUserName != ''">#{sysUserName},</if> <if test="sysUserName != null and sysUserName != ''">#{sysUserName},</if>
<if test="sysUserNickName != null and sysUserNickName != ''">#{sysUserNickName},</if> <if test="sysUserNickName != null and sysUserNickName != ''">#{sysUserNickName},</if>
<if test="sysUserPianqu != null and sysUserPianqu != ''">#{sysUserPianqu},</if>
</trim> </trim>
</insert> </insert>
@ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sapUserName != null and sapUserName != ''">sap_user_name = #{sapUserName},</if> <if test="sapUserName != null and sapUserName != ''">sap_user_name = #{sapUserName},</if>
<if test="sysUserName != null and sysUserName != ''">sys_user_name = #{sysUserName},</if> <if test="sysUserName != null and sysUserName != ''">sys_user_name = #{sysUserName},</if>
<if test="sysUserNickName != null and sysUserNickName != ''">sys_user_nick_name = #{sysUserNickName},</if> <if test="sysUserNickName != null and sysUserNickName != ''">sys_user_nick_name = #{sysUserNickName},</if>
<if test="sysUserPianqu != null and sysUserPianqu != ''">sys_user_pianqu = #{sysUserPianqu},</if>
</trim> </trim>
where sap_user_id = #{sapUserId} where sap_user_id = #{sapUserId}
</update> </update>

View File

@ -145,3 +145,12 @@ export function deptTreeSelect() {
method: 'get' method: 'get'
}) })
} }
// 获取切换账号的OA登录 token
export function getSwitchAccountToken(account) {
return request({
url: '/system/user/getSwitchAccountToken/'+account,
method: 'get'
})
}

View File

@ -25,6 +25,17 @@
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> </el-tooltip>
<el-dialog :title="switchAccountTitle" :visible.sync="switchAccountOpen" width="500px" append-to-body>
<el-form ref="form" :model="form" label-width="100px">
<el-form-item label="账号" prop="Name">
<el-input v-model="form.account" placeholder="请输入账号" clearable/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="switchAccountConfirm(form.account)"> </el-button>
</div>
</el-dialog>
</template> </template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
@ -39,6 +50,9 @@
<el-dropdown-item @click.native="setting = true"> <el-dropdown-item @click.native="setting = true">
<span>布局设置</span> <span>布局设置</span>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item @click.native="switchAccount" v-if="checkRole(['ITZX'])">
<span>切换账号</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout"> <el-dropdown-item divided @click.native="logout">
<span>退出登录</span> <span>退出登录</span>
</el-dropdown-item> </el-dropdown-item>
@ -61,7 +75,19 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
import settings from '@/settings' import settings from '@/settings'
import NavbarNotice from "@/layout/components/NavbarNotice.vue"; import NavbarNotice from "@/layout/components/NavbarNotice.vue";
import { getSwitchAccountToken } from "@/api/system/user";
import { checkRole } from "@/utils/permission"; //
export default { export default {
data() {
return {
//
switchAccountTitle: "",
//
switchAccountOpen: false,
form: {}
}
},
components: { components: {
Breadcrumb, Breadcrumb,
TopNav, TopNav,
@ -97,6 +123,18 @@ export default {
} }
}, },
methods: { methods: {
checkRole,
switchAccount() {
this.switchAccountTitle = "账号切换";
this.switchAccountOpen = true;
},
switchAccountConfirm(account){
// OA-token
getSwitchAccountToken(account).then(response => {
this.switchAccountOpen = false;
window.open('http://localhost:3335/ssoLogin?loginid='+account+'&token='+response.token, '_self');
})
},
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
}, },

View File

@ -25,14 +25,14 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="系统账户名称" prop="sysUserNickName"> <!--<el-form-item label="系统账户名称" prop="sysUserNickName">
<el-input <el-input
v-model="queryParams.sysUserNickName" v-model="queryParams.sysUserNickName"
placeholder="请输入系统账户名称" placeholder="请输入系统账户名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>-->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -92,6 +92,7 @@
<el-table-column label="SAP账户名称" align="center" prop="sapUserName" /> <el-table-column label="SAP账户名称" align="center" prop="sapUserName" />
<el-table-column label="系统账户" align="center" prop="sysUserName" /> <el-table-column label="系统账户" align="center" prop="sysUserName" />
<el-table-column label="系统账户名称" align="center" prop="sysUserNickName" /> <el-table-column label="系统账户名称" align="center" prop="sysUserNickName" />
<el-table-column label="片区" align="center" prop="sysUserPianqu" />
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -147,6 +148,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="片区" prop="sysUserPianqu">
<el-input v-model="form.sysUserPianqu" placeholder="请输入片区" />
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -188,7 +196,8 @@ export default {
sapUserBm: null, sapUserBm: null,
sapUserName: null, sapUserName: null,
sysUserName: null, sysUserName: null,
sysUserNickName: null sysUserNickName: null,
sysUserPianqu: null
}, },
// //
form: {}, form: {},
@ -205,6 +214,9 @@ export default {
], ],
sysUserNickName: [ sysUserNickName: [
{ required: true, message: "系统账户名称不能为空", trigger: "blur" } { required: true, message: "系统账户名称不能为空", trigger: "blur" }
],
sysUserPianqu: [
{ required: true, message: "片区不能为空", trigger: "blur" }
] ]
} }
}; };

View File

@ -39,6 +39,15 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="用户昵称" prop="nickName">
<el-input
v-model="queryParams.nickName"
placeholder="请输入用户昵称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input <el-input
v-model="queryParams.phonenumber" v-model="queryParams.phonenumber"
@ -142,7 +151,9 @@
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<!--
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" /> <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
-->
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible"> <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch