提交 6f141071 编写于 作者: X xiaoyu

平台、商户重置修改用户密码;重置商户默认用户密码;菜单列表名称修改

上级 faa82e50
......@@ -391,43 +391,43 @@ insert into t_sys_entitlement values('ENT_C_MAIN', '主页', 'home', '/main', 'M
insert into t_sys_entitlement values('ENT_C_MAIN_PAY_TYPE_COUNT', '主页交易方式统计', 'no-icon', '', '', 'PB', 0, 1, 'ENT_C_MAIN', '0', 'MGR', now(), now());
-- 商户管理
insert into t_sys_entitlement values('ENT_MCH_INFO', '商户管理', 'shop', '', 'RouteView', 'ML', 0, 1, 'ROOT', '30', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_LIST', '商户列表', 'profile', '/mch', 'MchListPage', 'ML', 0, 1, 'ENT_MCH_INFO', '10', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_LIST', '页面:商户列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_ADD', '按钮:新增', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_EDIT', '按钮:编辑', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_DEL', '按钮:删除', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_CONFIG_LIST', '商户支付参数配置列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH', '商户管理', 'shop', '', 'RouteView', 'ML', 0, 1, 'ROOT', '30', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO', '商户列表', 'profile', '/mch', 'MchListPage', 'ML', 0, 1, 'ENT_MCH', '10', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_LIST', '页面:商户列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_ADD', '按钮:新增', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_EDIT', '按钮:编辑', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_INFO_DEL', '按钮:删除', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_CONFIG_LIST', '商户支付参数配置列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_CONFIG_ADD', '商户支付参数配置', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_PAY_CONFIG_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_CONFIG_VIEW', '商户支付参数配置详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_PAY_CONFIG_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_PASSAGE_LIST', '商户支付通道配置列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_PASSAGE_LIST', '商户支付通道配置列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_PASSAGE_CONFIG', '商户支付通道配置入口', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_PAY_PASSAGE_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_PAY_PASSAGE_ADD', '商户支付通道配置保存', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_PAY_PASSAGE_LIST', '0', 'MGR', now(), now());
-- 服务商管理
insert into t_sys_entitlement values('ENT_ISV_INFO', '服务商管理', 'block', '', 'RouteView', 'ML', 0, 1, 'ROOT', '40', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_LIST', '服务商列表', 'profile', '/isv', 'IsvListPage', 'ML', 0, 1, 'ENT_ISV_INFO', '10', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_LIST', '页面:服务商列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_ADD', '按钮:新增', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_EDIT', '按钮:编辑', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_DEL', '按钮:删除', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_PAY_CONFIG_LIST', '服务商支付参数配置列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV', '服务商管理', 'block', '', 'RouteView', 'ML', 0, 1, 'ROOT', '40', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO', '服务商列表', 'profile', '/isv', 'IsvListPage', 'ML', 0, 1, 'ENT_ISV', '10', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_LIST', '页面:服务商列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_ADD', '按钮:新增', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_EDIT', '按钮:编辑', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_INFO_DEL', '按钮:删除', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_PAY_CONFIG_LIST', '服务商支付参数配置列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_PAY_CONFIG_ADD', '服务商支付参数配置', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_PAY_CONFIG_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ISV_PAY_CONFIG_VIEW', '服务商支付参数配置详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_ISV_PAY_CONFIG_LIST', '0', 'MGR', now(), now());
-- 订单管理
insert into t_sys_entitlement values('ENT_ORDER', '订单管理', 'transaction', '', 'RouteView', 'ML', 0, 1, 'ROOT', '50', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER_LIST', '支付订单', 'account-book', '/pay', 'PayOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '10', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ORDER_LIST', '页面:订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER_LIST', '退款订单', 'exception', '/refund', 'RefundOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '20', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_LIST', '页面:退款订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_NOTIFY_LIST', '商户通知', 'notification', '/notify', 'MchNotifyListPage', 'ML', 0, 1, 'ENT_ORDER', '30', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_NOTIFY_LIST', '页面:商户通知列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_NOTIFY_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_NOTIFY_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_NOTIFY_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER', '支付订单', 'account-book', '/pay', 'PayOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '10', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_ORDER_LIST', '页面:订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER', '退款订单', 'exception', '/refund', 'RefundOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '20', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_LIST', '页面:退款订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_NOTIFY', '商户通知', 'notification', '/notify', 'MchNotifyListPage', 'ML', 0, 1, 'ENT_ORDER', '30', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_NOTIFY_LIST', '页面:商户通知列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_NOTIFY', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_MCH_NOTIFY_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_MCH_NOTIFY', '0', 'MGR', now(), now());
-- 支付配置菜单
insert into t_sys_entitlement values('ENT_PC', '支付配置', 'file-done', '', 'RouteView', 'ML', 0, 1, 'ROOT', '60', 'MGR', now(), now());
......@@ -455,6 +455,7 @@ insert into t_sys_entitlement values('ENT_SYS_CONFIG', '系统管理', 'setting'
insert into t_sys_entitlement values('ENT_UR_USER_ADD', '按钮:添加操作员', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_VIEW', '按钮: 详情', '', 'no-icon', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_EDIT', '按钮: 修改基本信息', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_DELETE', '按钮: 删除操作员', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_UPD_ROLE', '按钮: 角色分配', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_UR_ROLE', '角色管理', 'user', '/roles', 'RolePage', 'ML', 0, 1, 'ENT_UR', '20', 'MGR', now(), now());
......@@ -472,10 +473,10 @@ insert into t_sys_entitlement values('ENT_SYS_CONFIG', '系统管理', 'setting'
insert into t_sys_entitlement values('ENT_SYS_CONFIG_INFO', '系统配置', 'setting', '/config', 'SysConfigPage', 'ML', 0, 1, 'ENT_SYS_CONFIG', '15', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_SYS_CONFIG_EDIT', '按钮: 修改', 'no-icon', '', '', 'PB', 0, 1, 'ENT_SYS_CONFIG_INFO', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_SYS_LOG_LIST', '系统日志', 'file-text', '/log', 'SysLogPage', 'ML', 0, 1, 'ENT_SYS_CONFIG', '20', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_LOG_LIST', '页面:系统日志列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_SYS_LOG_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_SYS_LOG_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_SYS_LOG_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_SYS_LOG_DEL', '按钮:删除', 'no-icon', '', '', 'PB', 0, 1, 'ENT_SYS_LOG_LIST', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_SYS_LOG', '系统日志', 'file-text', '/log', 'SysLogPage', 'ML', 0, 1, 'ENT_SYS_CONFIG', '20', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_LOG_LIST', '页面:系统日志列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_SYS_LOG', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_SYS_LOG_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_SYS_LOG', '0', 'MGR', now(), now());
insert into t_sys_entitlement values('ENT_SYS_LOG_DEL', '按钮:删除', 'no-icon', '', '', 'PB', 0, 1, 'ENT_SYS_LOG', '0', 'MGR', now(), now());
-- 【商户系统】 主页
......@@ -496,12 +497,12 @@ insert into t_sys_entitlement values('ENT_MCH_MAIN', '主页', 'home', '/main',
-- 【商户系统】 订单管理
insert into t_sys_entitlement values('ENT_ORDER', '订单中心', 'transaction', '', 'RouteView', 'ML', 0, 1, 'ROOT', '20', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER_LIST', '订单管理', 'account-book', '/pay', 'PayOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '10', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_ORDER_LIST', '页面:订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER_LIST', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER_LIST', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER_LIST', '退款记录', 'exception', '/refund', 'RefundOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '20', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_LIST', '页面:退款订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER_LIST', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER_LIST', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER', '订单管理', 'account-book', '/pay', 'PayOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '10', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_ORDER_LIST', '页面:订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_PAY_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_PAY_ORDER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER', '退款记录', 'exception', '/refund', 'RefundOrderListPage', 'ML', 0, 1, 'ENT_ORDER', '20', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_LIST', '页面:退款订单列表', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_REFUND_ORDER_VIEW', '按钮:详情', 'no-icon', '', '', 'PB', 0, 1, 'ENT_REFUND_ORDER', '0', 'MCH', now(), now());
-- 【商户系统】 支付配置
insert into t_sys_entitlement values('ENT_MCH_PC', '支付配置', 'file-done', '', 'RouteView', 'ML', 0, 1, 'ROOT', '30', 'MCH', now(), now());
......@@ -522,6 +523,7 @@ insert into t_sys_entitlement values('ENT_SYS_CONFIG', '系统管理', 'setting'
insert into t_sys_entitlement values('ENT_UR_USER_ADD', '按钮:添加操作员', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_VIEW', '按钮: 详情', '', 'no-icon', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_EDIT', '按钮: 修改基本信息', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_DELETE', '按钮: 删除操作员', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_UR_USER_UPD_ROLE', '按钮: 角色分配', 'no-icon', '', '', 'PB', 0, 1, 'ENT_UR_USER', '0', 'MCH', now(), now());
insert into t_sys_entitlement values('ENT_UR_ROLE', '角色管理', 'user', '/roles', 'RolePage', 'ML', 0, 1, 'ENT_UR', '20', 'MCH', now(), now());
......
......@@ -28,6 +28,7 @@ import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.mq.queue.MqQueue4ModifyMchUserRemove;
import com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchInfo;
import com.jeequan.jeepay.service.impl.MchInfoService;
import com.jeequan.jeepay.service.impl.SysUserAuthService;
import com.jeequan.jeepay.service.impl.SysUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -38,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
......@@ -55,6 +57,7 @@ public class MchInfoController extends CommonCtrl {
@Autowired private SysUserService sysUserService;
@Autowired private MqTopic4ModifyMchInfo mqTopic4ModifyMchInfo;
@Autowired private MqQueue4ModifyMchUserRemove mqQueue4ModifyMchUserRemove;
@Autowired private SysUserAuthService sysUserAuthService;
/**
* @author: pangxiaoyu
......@@ -153,6 +156,29 @@ public class MchInfoController extends CommonCtrl {
// 推送mq删除redis用户缓存
mqQueue4ModifyMchUserRemove.push(StringUtils.join(userIdList, ","));
}
//判断是否重置密码
Boolean resetPass = getReqParamJSON().getBoolean("resetPass");
if (resetPass != null && resetPass) {
Boolean defaultPass = getReqParamJSON().getBoolean("defaultPass");
String updatePwd = "";
if (!defaultPass) {
// 获取修改的密码
updatePwd = getValStringRequired("confirmPwd");
}else {
// 重置默认密码
updatePwd = CS.DEFAULT_PWD;
}
// 获取商户最初的用户
List<SysUser> userList = sysUserService.list(SysUser.gw()
.eq(SysUser::getBelongInfoId, mchNo)
.eq(SysUser::getSysType, CS.SYS_TYPE.MCH)
.orderByAsc(SysUser::getCreatedAt)
);
sysUserAuthService.resetAuthInfo(userList.get(0).getSysUserId(), null, null, updatePwd, CS.SYS_TYPE.MCH);
// 推送mq删除redis用户缓存
mqQueue4ModifyMchUserRemove.push(StringUtils.join(Arrays.asList(userList.get(0).getSysUserId()), ","));
}
boolean result = mchInfoService.updateById(mchInfo);
mqTopic4ModifyMchInfo.push(mchNo); // 推送mq到目前节点进行更新数据
if (!result) return ApiRes.fail(ApiCodeEnum.SYS_OPERATION_FAIL_UPDATE);
......
......@@ -131,18 +131,57 @@ public class SysUserController extends CommonCtrl {
public ApiRes update(@PathVariable("recordId") Long recordId) {
SysUser sysUser = getObject(SysUser.class);
sysUser.setSysUserId(recordId);
Boolean resetPass = getReqParamJSON().getBoolean("resetPass");
//判断是否自己禁用自己
if(recordId.equals(getCurrentUser().getSysUser().getSysUserId()) && sysUser.getState() != null && sysUser.getState() == CS.PUB_DISABLE){
throw new BizException("系统不允许禁用当前登陆用户!");
}
//判断是否重置密码
if (resetPass != null && resetPass) {
Boolean defaultPass = getReqParamJSON().getBoolean("defaultPass");
String updatePwd = "";
if (!defaultPass) {
// 获取修改的密码
updatePwd = getValStringRequired("confirmPwd");
}else {
// 重置默认密码
updatePwd = CS.DEFAULT_PWD;
}
sysUserAuthService.resetAuthInfo(recordId, null, null, updatePwd, CS.SYS_TYPE.MGR);
// 删除用户redis缓存信息
authService.delAuthentication(Arrays.asList(recordId));
}
sysUserService.updateSysUser(sysUser);
//如果用户被禁用,需要更新redis数据
if(sysUser.getState() != null && sysUser.getState() == CS.PUB_DISABLE){
authService.refAuthentication(Arrays.asList(recordId));
}
return ApiRes.ok();
}
/** delete */
@PreAuthorize("hasAuthority( 'ENT_UR_USER_DELETE' )")
@RequestMapping(value="/{recordId}", method = RequestMethod.DELETE)
@MethodLog(remark = "删除操作员信息")
public ApiRes delete(@PathVariable("recordId") Long recordId) {
//查询该操作员信息
SysUser sysUser = sysUserService.getById(recordId);
if (sysUser == null) {
throw new BizException("该操作员不存在!");
}
//判断是否自己删除自己
if(recordId.equals(getCurrentUser().getSysUser().getSysUserId())){
throw new BizException("系统不允许删除当前登陆用户!");
}
// 删除用户
sysUserService.removeUser(sysUser, CS.SYS_TYPE.MGR);
//如果用户被删除,需要更新redis数据
authService.refAuthentication(Arrays.asList(recordId));
return ApiRes.ok();
}
......
......@@ -166,6 +166,22 @@ public class AuthService {
}
/** 根据用户ID 删除用户缓存信息 **/
public void delAuthentication(List<Long> sysUserIdList){
if(sysUserIdList == null || sysUserIdList.isEmpty()){
return ;
}
for (Long sysUserId : sysUserIdList) {
Collection<String> cacheKeyList = RedisUtil.keys(CS.getCacheKeyToken(sysUserId, "*"));
if(cacheKeyList == null || cacheKeyList.isEmpty()){
continue;
}
for (String cacheKey : cacheKeyList) {
RedisUtil.del(cacheKey);
}
}
}
public List<SimpleGrantedAuthority> getUserAuthority(SysUser sysUser){
//用户拥有的角色集合 需要以ROLE_ 开头, 用户拥有的权限集合
......
......@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
/**
* 用户管理类
......@@ -140,11 +141,28 @@ public class SysUserController extends CommonCtrl {
SysUser dbRecord = sysUserService.getOne(SysUser.gw().eq(SysUser::getSysUserId, recordId).eq(SysUser::getBelongInfoId, getCurrentMchNo()));
if (dbRecord == null) throw new BizException(ApiCodeEnum.SYS_OPERATION_FAIL_SELETE);
Boolean resetPass = getReqParamJSON().getBoolean("resetPass");
//判断是否自己禁用自己
if(recordId.equals(getCurrentUser().getSysUser().getSysUserId()) && sysUser.getState() != null && sysUser.getState() == CS.PUB_DISABLE){
throw new BizException("系统不允许禁用当前登陆用户!");
}
//判断是否重置密码
if (resetPass != null && resetPass) {
Boolean defaultPass = getReqParamJSON().getBoolean("defaultPass");
String updatePwd = "";
if (!defaultPass) {
// 获取修改的密码
updatePwd = getValStringRequired("confirmPwd");
}else {
// 重置默认密码
updatePwd = CS.DEFAULT_PWD;
}
sysUserAuthService.resetAuthInfo(recordId, null, null, updatePwd, CS.SYS_TYPE.MCH);
// 删除用户redis缓存信息
authService.delAuthentication(Arrays.asList(recordId));
}
sysUserService.updateSysUser(sysUser);
//如果用户被禁用,需要更新redis数据
......@@ -155,5 +173,39 @@ public class SysUserController extends CommonCtrl {
return ApiRes.ok();
}
/** delete */
@PreAuthorize("hasAuthority( 'ENT_UR_USER_DELETE' )")
@RequestMapping(value="/{recordId}", method = RequestMethod.DELETE)
@MethodLog(remark = "删除操作员信息")
public ApiRes delete(@PathVariable("recordId") Long recordId) {
//查询该操作员信息
SysUser sysUser = sysUserService.getById(recordId);
if (sysUser == null) {
throw new BizException("该操作员不存在!");
}
//判断是否自己删除自己
if(recordId.equals(getCurrentUser().getSysUser().getSysUserId())){
throw new BizException("系统不允许删除当前登陆用户!");
}
//判断是否删除商户默认超管
List<SysUser> userList = sysUserService.list(SysUser.gw()
.eq(SysUser::getBelongInfoId, sysUser.getBelongInfoId())
.eq(SysUser::getSysType, CS.SYS_TYPE.MCH)
.orderByAsc(SysUser::getCreatedAt)
);
if (userList.size() > 0 && userList.get(0).getSysUserId().equals(recordId)) {
throw new BizException("系统不允许删除商户默认用户!");
}
// 删除用户
sysUserService.removeUser(sysUser, CS.SYS_TYPE.MCH);
//如果用户被删除,需要更新redis数据
authService.refAuthentication(Arrays.asList(recordId));
return ApiRes.ok();
}
}
......@@ -175,6 +175,22 @@ public class AuthService {
}
/** 根据用户ID 删除用户缓存信息 **/
public void delAuthentication(List<Long> sysUserIdList){
if(sysUserIdList == null || sysUserIdList.isEmpty()){
return ;
}
for (Long sysUserId : sysUserIdList) {
Collection<String> cacheKeyList = RedisUtil.keys(CS.getCacheKeyToken(sysUserId, "*"));
if(cacheKeyList == null || cacheKeyList.isEmpty()){
continue;
}
for (String cacheKey : cacheKeyList) {
RedisUtil.del(cacheKey);
}
}
}
public List<SimpleGrantedAuthority> getUserAuthority(SysUser sysUser){
//用户拥有的角色集合 需要以ROLE_ 开头, 用户拥有的权限集合
......
......@@ -15,6 +15,7 @@
*/
package com.jeequan.jeepay.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import com.jeequan.jeepay.core.constants.CS;
......@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
......@@ -86,6 +88,7 @@ public class MchInfoService extends ServiceImpl<MchInfoMapper, MchInfo> {
}
/** 删除商户 **/
@Transactional(rollbackFor = Exception.class)
public List<Long> removeByMchNo(String mchNo) {
try {
......
......@@ -18,6 +18,7 @@ package com.jeequan.jeepay.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.SysUser;
import com.jeequan.jeepay.core.entity.SysUserAuth;
import com.jeequan.jeepay.core.entity.SysUserRoleRela;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.core.utils.StringKit;
......@@ -144,5 +145,17 @@ public class SysUserService extends ServiceImpl<SysUserMapper, SysUser> {
}
}
/** 删除用户 **/
@Transactional
public void removeUser(SysUser sysUser, String sysType) {
// 1.删除用户登录信息
sysUserAuthService.remove(SysUserAuth.gw()
.eq(SysUserAuth::getSysType, sysType)
.in(SysUserAuth::getUserId, sysUser.getSysUserId())
);
// 2.删除用户角色信息
sysUserRoleRelaService.removeById(sysUser.getSysUserId());
// 3.删除用户信息
removeById(sysUser.getSysUserId());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册