改成支持 如果是一个企业的话 默认登录后选择这一个企业
This commit is contained in:
parent
1220e38d38
commit
daa0172240
|
|
@ -1,11 +1,14 @@
|
|||
package com.ruoyi.excel.wecom.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.excel.wecom.domain.CorpInfo;
|
||||
import com.ruoyi.excel.wecom.mapper.CorpInfoMapper;
|
||||
import com.ruoyi.excel.wecom.service.ICorpInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -13,10 +16,19 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
public class CorpInfoServiceImpl implements ICorpInfoService {
|
||||
|
||||
private static final String CURRENT_CORP_KEY_PREFIX_ONLY = "current_corp_only:";
|
||||
@Autowired
|
||||
private CorpInfoMapper corpInfoMapper;
|
||||
|
||||
@PostConstruct
|
||||
public void setCorpInfoWhenOne() {
|
||||
List<CorpInfo> corpInfos = corpInfoMapper.selectList(null);
|
||||
if(corpInfos.size() == 1) {
|
||||
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
|
||||
String corpId = corpInfos.get(0).getCorpId();
|
||||
redisCache.setCacheObject(CURRENT_CORP_KEY_PREFIX_ONLY, corpId);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询企业信息列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 客户统计数据VO
|
||||
* 流量看板数据VO
|
||||
* 用于EasyExcel导出客户统计数据
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import java.util.Set;
|
|||
public class SysLoginController
|
||||
{
|
||||
private static final String CURRENT_CORP_KEY_PREFIX = "current_corp:";
|
||||
private static final String CURRENT_CORP_KEY_PREFIX_ONLY = "current_corp_only:";
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
|
@ -82,8 +83,6 @@ public class SysLoginController
|
|||
{
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
|
||||
|
||||
SysUser user = loginUser.getUser();
|
||||
// 1. 获取当前登录用户ID
|
||||
Long userId = user.getUserId();
|
||||
|
|
@ -93,6 +92,10 @@ public class SysLoginController
|
|||
String corpId = redisCache.getCacheObject(key);
|
||||
if (corpId != null) {
|
||||
CorpContextHolder.setCurrentCorpId(corpId);
|
||||
} else {
|
||||
//获取唯一的corpId
|
||||
corpId = redisCache.getCacheObject(CURRENT_CORP_KEY_PREFIX_ONLY);
|
||||
CorpContextHolder.setCurrentCorpId(corpId);
|
||||
}
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ public class CorpContextHolder {
|
|||
*/
|
||||
private static final String CURRENT_CORP_KEY_PREFIX = "current_corp:";
|
||||
|
||||
private static final String CURRENT_CORP_KEY_PREFIX_ONLY = "current_corp_only:";
|
||||
|
||||
/**
|
||||
* 获取当前用户正在使用的企业ID
|
||||
*
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ export default {
|
|||
footerContent: defaultSettings.footerContent,
|
||||
codeUrl: "",
|
||||
loginForm: {
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
|
|
|
|||
|
|
@ -61,10 +61,7 @@
|
|||
|
||||
<el-table v-loading="loading" :data="corpList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="ID" align="center" prop="id" width="80" />
|
||||
<el-table-column label="企业ID" align="center" prop="corpId" width="200" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="企业名称" align="center" prop="name" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="Secret" align="center" prop="secret" width="300" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
|
|
|||
Loading…
Reference in New Issue