调整登录,菜单,角色
This commit is contained in:
parent
ce01210aab
commit
63a16aa6d1
@ -1,19 +1,9 @@
|
||||
package com.cpop.core.listen;
|
||||
|
||||
import cn.dev33.satoken.listener.SaTokenListener;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.cpop.core.base.enums.OperationLogEnum;
|
||||
import com.cpop.core.constant.Constants;
|
||||
import com.cpop.core.service.OperationLogService;
|
||||
import com.cpop.core.service.UserService;
|
||||
import com.cpop.core.utils.MessageUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static com.cpop.core.base.table.table.UserTableDef.USER;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
@ -33,14 +23,6 @@ public class JamboxSaTokenListener implements SaTokenListener {
|
||||
*/
|
||||
@Override
|
||||
public void doLogin(String loginType, Object loginId, String tokenValue, SaLoginModel loginModel) {
|
||||
//添加登录成功日志
|
||||
SaSession session = StpUtil.getSessionByLoginId(loginId);
|
||||
SpringUtils.getBean(OperationLogService.class).insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGIN, session, MessageUtils.message("i18n_login_success"));
|
||||
//更新登录记录
|
||||
SpringUtils.getBean(UserService.class).updateChain()
|
||||
.set(USER.LOGIN_IP, session.getString("loginIp"))
|
||||
.where(USER.USER_NAME.eq(session.getString("username")))
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -51,7 +51,7 @@ mongo-plus:
|
||||
#端口
|
||||
port: 27017
|
||||
#数据库名
|
||||
database: jambox_dev
|
||||
database: cpop_dev
|
||||
#用户名,没有可不填(若账号中出现@,!等等符号,不需要再进行转码!!!)
|
||||
username: mongo_kBXjhm
|
||||
#密码,同上(若密码中出现@,!等等符号,不需要再进行转码!!!)
|
||||
@ -66,9 +66,9 @@ mybatis-flex:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
datasource:
|
||||
oam:
|
||||
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Customer0401
|
||||
url: jdbc:mysql://bj-cynosdbmysql-grp-anccz88g.sql.tencentcdb.com:24808/cpop_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: cpop_dev
|
||||
password: Ch5WkZRsCATsnMXw
|
||||
jambox:
|
||||
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
|
||||
username: root
|
||||
|
||||
@ -1,114 +0,0 @@
|
||||
# 项目相关配置
|
||||
cpop:
|
||||
# 文件路径 示例( Windows配置W:/WorkSpace/java/uploadPath,Linux配置 /home/baseFramework/uploadPath)
|
||||
profile: E:/Cpop/uploadPath
|
||||
jwt:
|
||||
#白名单
|
||||
whiteList: /websocket/*,/login,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/sysCommon/miniSyncBrandAndStore,/easyLearn/callback/*/*,/easyLearn/*,/mini/cardTemplate/*,/website/**,/backstage/wxCp/*,/callback/wxCp/*/registerCode,/callback/easyLearn/**
|
||||
gateway:
|
||||
rsa-keypair:
|
||||
# 公钥文件
|
||||
publicKeyFile: /root/Cpop-Oam/keyPair/publicKey
|
||||
# 公钥文件
|
||||
privateKeyFile: /root/Cpop-Oam/keyPair/privateKey
|
||||
|
||||
# DataSource Config
|
||||
spring:
|
||||
application:
|
||||
name: Cpop-Oam-Dev
|
||||
#redis配置
|
||||
redis:
|
||||
#地址
|
||||
host: gz-crs-lv77ii2t.sql.tencentcdb.com
|
||||
#端口
|
||||
port: 27714
|
||||
#数据库
|
||||
database: 1
|
||||
#密码
|
||||
password: Cpop2022@
|
||||
#连接超时
|
||||
timeout: 5000
|
||||
jedis:
|
||||
pool:
|
||||
#
|
||||
min-idle: 0
|
||||
#
|
||||
max-idle: 16
|
||||
#
|
||||
max-active: 16
|
||||
#
|
||||
max-wait: -1ms
|
||||
client-type: jedis
|
||||
data:
|
||||
mongodb:
|
||||
host: localhost
|
||||
port: 27017
|
||||
database: cpop-dev
|
||||
username: Cpop
|
||||
password: Admin@123
|
||||
|
||||
server:
|
||||
port: 9420
|
||||
servlet:
|
||||
context-path: /Cpop-Oam
|
||||
|
||||
#Mybatis-Flex
|
||||
mybatis-flex:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
datasource:
|
||||
oam:
|
||||
url: jdbc:mysql://192.168.3.61:3306/cpop_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Admin@123
|
||||
jambox:
|
||||
url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
|
||||
username: root
|
||||
password: Customer0401
|
||||
|
||||
# springdoc-openapi项目配置
|
||||
knife4j:
|
||||
enable: true
|
||||
openapi:
|
||||
title: PuPu-OAM开发API
|
||||
description: PuPu-OAM开发API
|
||||
email:
|
||||
concat: DB
|
||||
url: https://api.jamboxsys.com
|
||||
version: 1.0.0
|
||||
license: Apache 2.0
|
||||
license-url: https://stackoverflow.com/
|
||||
terms-of-service-url: https://api.jamboxsys.com
|
||||
group:
|
||||
#系统
|
||||
Oam:
|
||||
group-name: Oam
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- com.cpop.oam
|
||||
#系统
|
||||
System:
|
||||
group-name: System
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- com.cpop.system
|
||||
#果酱
|
||||
Jambox:
|
||||
group-name: Jambox
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- com.cpop.jambox
|
||||
|
||||
#微信
|
||||
wx:
|
||||
pay:
|
||||
# p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头)
|
||||
keyPath: /root/Cpop-Oam/keyPair/wxPay_cert.p12
|
||||
# 私钥证书
|
||||
privateKeyPath: /root/Cpop-Oam/keyPair/wxPay_key.pem
|
||||
# 私钥文件
|
||||
privateCertPath: /root/Cpop-Oam/keyPair/wxPay_cert.pem
|
||||
# 先学后付用户签约通知地址
|
||||
learn-now-pay-later-user-sign-plan-notify-url: https://frp-oak.top:11899/Cpop-Oam/callback/easyLearn/learnNowPayLaterUserSignPlanNotify
|
||||
# 先学后付用户核销通知地址
|
||||
learn-now-pay-later-service-order-notify-url: https://frp-oak.top:11899/Cpop-Oam/callback/easyLearn/learnNowPayLaterUserSignPlanNotify
|
||||
@ -1,29 +1,9 @@
|
||||
#\u767B\u5F55\u4FE1\u606F
|
||||
#\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F
|
||||
i18n_operationLog_systemLogin=System User Login
|
||||
i18n_operationLog_systemLogout=System User Logout
|
||||
i18n_operationLog_updateOamConfig=Update System Config
|
||||
i18n_operationLog_insertOamMenu=Insert Oam Menu
|
||||
i18n_operationLog_updateOamMenu=Update Oam Menu
|
||||
i18n_operationLog_removeOamMenu=Remove Oam Menu
|
||||
i18n_operationLog_insertOamRole=Insert Oam Role
|
||||
i18n_operationLog_updateOamRole=Update Oam Role
|
||||
i18n_operationLog_removeOamRole=Remove Oam Role
|
||||
i18n_operationLog_insertOamDept=Insert Oam Dept
|
||||
i18n_operationLog_updateOamDept=Update Oam Dept
|
||||
i18n_operationLog_removeOamDept=Remove Oam Dept
|
||||
i18n_operationLog_insertOamStaff=Insert Oam User
|
||||
i18n_operationLog_updateOamStaff=Update Oam User
|
||||
i18n_operationLog_removeOamStaff=Remove Oam User
|
||||
i18n_operationLog_updateOamStaffPassword=Update Oam Staff Password
|
||||
|
||||
#\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F
|
||||
i18n_alert_peopleUnderTheDepartmentError=There are people under the department, it is not allowed to delete the department!
|
||||
i18n_alert_departmentNotDeactivatedError=The current department is not deactivated, deletion is not allowed\uFF01
|
||||
i18n_alert_userOrPhoneOrEmailIsExist=Username or mobile phone number or email address already exists
|
||||
i18n_alert_userIsExist=User already exists
|
||||
i18n_alert_oldPasswordIsWrong=The old password was entered incorrectly, please try again
|
||||
|
||||
#\u7CFB\u7EDF\u57FA\u7840\u4FE1\u606F
|
||||
i18n_baseInfo_success=Success
|
||||
i18n_baseInfo_failed=Failed
|
||||
#\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F
|
||||
i18n_alert_accountIsExist=Account already exist!
|
||||
i18n_alert_oldPasswordIsWrong=The old password was entered incorrectly, please try again
|
||||
#\u7CFB\u7EDF\u64CD\u4F5C\u65E5\u5FD7
|
||||
i18n_operationLog_systemLogin=System User Login
|
||||
i18n_operationLog_systemLogout=System User Logout
|
||||
@ -1,29 +1,9 @@
|
||||
#\u767B\u5F55\u4FE1\u606F
|
||||
#\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F
|
||||
i18n_operationLog_systemLogin=\u7CFB\u7EDF\u7528\u6237\u767B\u5F55
|
||||
i18n_operationLog_systemLogout=\u7CFB\u7EDF\u7528\u6237\u9000\u51FA
|
||||
i18n_operationLog_updateOamConfig=\u4FEE\u6539\u7CFB\u7EDF\u914D\u7F6E
|
||||
i18n_operationLog_insertOamMenu=\u6DFB\u52A0OAM\u83DC\u5355
|
||||
i18n_operationLog_updateOamMenu=\u4FEE\u6539OAM\u83DC\u5355
|
||||
i18n_operationLog_removeOamMenu=\u5220\u9664OAM\u83DC\u5355
|
||||
i18n_operationLog_insertOamRole=\u6DFB\u52A0OAM\u89D2\u8272
|
||||
i18n_operationLog_updateOamRole=\u4FEE\u6539OAM\u89D2\u8272
|
||||
i18n_operationLog_removeOamRole=\u5220\u9664OAM\u89D2\u8272
|
||||
i18n_operationLog_insertOamDept=\u6DFB\u52A0OAM\u90E8\u95E8
|
||||
i18n_operationLog_updateOamDept=\u4FEE\u6539OAM\u90E8\u95E8
|
||||
i18n_operationLog_removeOamDept=\u5220\u9664OAM\u90E8\u95E8
|
||||
i18n_operationLog_insertOamStaff=\u6DFB\u52A0OAM\u7528\u6237
|
||||
i18n_operationLog_updateOamStaff=\u4FEE\u6539OAM\u7528\u6237
|
||||
i18n_operationLog_removeOamStaff=\u5220\u9664OAM\u7528\u6237
|
||||
i18n_operationLog_updateOamStaffPassword=\u4FEE\u6539OAM\u7528\u6237\u5BC6\u7801
|
||||
|
||||
#\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F
|
||||
i18n_alert_peopleUnderTheDepartmentError=\u5F53\u524D\u90E8\u95E8\u4E0B\u6709\u4EBA\u5458\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01
|
||||
i18n_alert_departmentNotDeactivatedError=\u5F53\u524D\u90E8\u95E8\u672A\u505C\u7528\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01
|
||||
i18n_alert_userOrPhoneOrEmailIsExist=\u7528\u6237\u540D\u6216\u624B\u673A\u53F7\u6216\u90AE\u7BB1\u5DF2\u5B58\u5728
|
||||
i18n_alert_userIsExist=\u7528\u6237\u5DF2\u5B58\u5728
|
||||
i18n_alert_oldPasswordIsWrong=\u65E7\u5BC6\u7801\u8F93\u5165\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165
|
||||
|
||||
#\u7CFB\u7EDF\u57FA\u7840\u4FE1\u606F
|
||||
i18n_baseInfo_success=\u6210\u529F
|
||||
i18n_baseInfo_failed=\u5931\u8D25
|
||||
#\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F
|
||||
i18n_alert_accountIsExist=\u8D26\u53F7\u5DF2\u5B58\u5728
|
||||
i18n_alert_oldPasswordIsWrong=\u65E7\u5BC6\u7801\u8F93\u5165\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165
|
||||
#\u7CFB\u7EDF\u64CD\u4F5C\u65E5\u5FD7
|
||||
i18n_operationLog_systemLogin=\u7CFB\u7EDF\u7528\u6237\u767B\u5F55
|
||||
i18n_operationLog_systemLogout=\u7CFB\u7EDF\u7528\u6237\u9000\u51FA
|
||||
@ -3,6 +3,7 @@ package com.cpop.oam.business.service.impl;
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.base.exception.ServiceException;
|
||||
import com.cpop.core.base.table.User;
|
||||
import com.cpop.core.constant.Constants;
|
||||
@ -97,7 +98,8 @@ public class LoginServiceImpl implements LoginService {
|
||||
}
|
||||
staffLoginInfo.setUserId(user.getId())
|
||||
.setAvatar(user.getAvatar())
|
||||
.setPhone(user.getPhone());
|
||||
.setPhone(user.getPhone())
|
||||
.setUserType(UserType.OAM_USER);
|
||||
return staffLoginInfo;
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ import com.cpop.system.framework.enums.InitRoleEnum;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -93,10 +94,9 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
||||
//状态不为空
|
||||
.and(MENU.STATUS.eq(bo.getStatus()))
|
||||
//标题不为空
|
||||
.and(MENU.TITLE.like(bo.getTitle()))
|
||||
.and(MENU.TITLE.likeLeft(bo.getTitle()))
|
||||
//构建公共菜单与特有菜单
|
||||
.and(MENU.USER_TYPE.eq(StpUtil.getSession().get("userType")))
|
||||
.and(MENU.NAME.notIn(Constants.HIDE_MENU.split(",")))
|
||||
.orderBy(MENU.ORDER_NO.asc()), MenuVo.class));
|
||||
}
|
||||
|
||||
@ -230,9 +230,10 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
||||
* @since 2023/5/10 16:01
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeSysMenu(String id) {
|
||||
//查询所有
|
||||
List<Menu> list = this.list();
|
||||
List<Menu> list = this.queryChain().where(MENU.USER_TYPE.eq(StpUtil.getSession().get("userType"))).list();
|
||||
//递归获取当前菜单及其下属子菜单
|
||||
List<String> removeIds = new ArrayList<>();
|
||||
recursionRemove(list, id, removeIds);
|
||||
|
||||
@ -53,7 +53,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||
QueryWrapper.create()
|
||||
.select(ROLE.ALL_COLUMNS)
|
||||
.where(ROLE.ID.ne(InitRoleEnum.SUPER_OAM_ROLE.getId()))
|
||||
.and(ROLE.ROLE_NAME.like(bo.getRoleName()))
|
||||
.and(ROLE.ROLE_NAME.likeLeft(bo.getRoleName()))
|
||||
.and(ROLE.STATUS.eq(bo.getStatus()))
|
||||
.and(ROLE.USER_TYPE.eq(StpUtil.getSession().get("userType")))
|
||||
.orderBy(ROLE.ORDER_NO.asc())
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
package com.cpop.system.framework.config;
|
||||
|
||||
import cn.dev33.satoken.exception.SaTokenException;
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.stp.StpLogic;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.cpop.core.base.enums.UserType;
|
||||
import com.cpop.core.constant.Constants;
|
||||
import com.cpop.core.constant.HttpStatus;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@ -20,7 +16,6 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
@ -56,23 +51,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
||||
registry.addInterceptor(new SaInterceptor(handle -> {
|
||||
SaRouter.match("/**")
|
||||
//基础接口不做处理
|
||||
.notMatch("/backstage/getUserInfo", "/backstage/getPermCode", "/backstage/getMenuList","/backstage/index/getExtendList","/backstage/logout","/backstage/index/changeDistrict/*","/backstage/index/changeBackstageSystem")
|
||||
.check(r -> {
|
||||
StpUtil.checkLogin();
|
||||
//检查登录账号是否过期
|
||||
if (StpUtil.getSession().get("userType") == UserType.OAM_USER) {
|
||||
LocalDate expireDate = (LocalDate) StpUtil.getSession().get("expireDate");
|
||||
if (LocalDate.now().isAfter(expireDate)) {
|
||||
throw new SaTokenException(HttpStatus.STORE_EXPIRE, "校区已过期");
|
||||
}
|
||||
}
|
||||
});
|
||||
SaRouter.match("/backstage/getUserInfo", "/backstage/getPermCode", "/backstage/getMenuList","/backstage/index/getExtendList","/backstage/logout","/backstage/index/changeDistrict/*","/backstage/index/changeBackstageSystem")
|
||||
.check(r -> {
|
||||
StpUtil.checkLogin();
|
||||
});
|
||||
StpUtil.checkLogin();
|
||||
}))
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns(Arrays.asList(whiteList.split(",")));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user