pull/1121/head
parent
00176bb2f8
commit
0e93ca723e
|
|
@ -0,0 +1,78 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.model.MenuInfo;
|
||||
import com.ruoyi.common.core.domain.model.MenuListItem;
|
||||
import com.ruoyi.common.core.domain.model.MenuQuery;
|
||||
import com.ruoyi.common.core.domain.model.MenuTreeNode;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import com.ruoyi.web.controller.system.vo.MenuInfoVO;
|
||||
import com.ruoyi.web.controller.system.vo.MenuListItemVO;
|
||||
import com.ruoyi.web.controller.system.vo.MenuQueryVO;
|
||||
import com.ruoyi.web.controller.system.vo.MenuTreeNodeVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "档口菜单")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/store/menu")
|
||||
public class StoreMenuController extends XktBaseController {
|
||||
|
||||
final ISysMenuService menuService;
|
||||
|
||||
final TokenService tokenService;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "菜单列表查询 - 档口")
|
||||
@PostMapping("/list")
|
||||
public R<List<MenuListItemVO>> listByStore(@Validated @RequestBody MenuQueryVO vo) {
|
||||
MenuQuery query = BeanUtil.toBean(vo, MenuQuery.class);
|
||||
Set<Long> usableMenuIds = menuService.storeUsableMenuIds();
|
||||
List<MenuListItem> list = menuService.listMenu(query)
|
||||
.stream()
|
||||
.filter(o -> usableMenuIds.contains(o.getMenuId()))
|
||||
.collect(Collectors.toList());
|
||||
return R.ok(BeanUtil.copyToList(list, MenuListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "菜单树查询 - 档口")
|
||||
@PostMapping("/tree")
|
||||
public R<List<MenuTreeNodeVO>> treeByStore(@Validated @RequestBody MenuQueryVO vo) {
|
||||
MenuQuery query = BeanUtil.toBean(vo, MenuQuery.class);
|
||||
Set<Long> usableMenuIds = menuService.storeUsableMenuIds();
|
||||
if (CollUtil.isNotEmpty(query.getMenuIds())) {
|
||||
query.setMenuIds(new ArrayList<>(CollUtil.intersection(usableMenuIds, query.getMenuIds())));
|
||||
} else {
|
||||
query.setMenuIds(new ArrayList<>(usableMenuIds));
|
||||
}
|
||||
List<MenuTreeNode> tree = menuService.getMenuTree(query);
|
||||
return R.ok(BeanUtil.copyToList(tree, MenuTreeNodeVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "菜单详情")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R<MenuInfoVO> getInfo(@PathVariable("id") Long id) {
|
||||
MenuInfo infoDTO = menuService.getMenuById(id);
|
||||
return R.ok(BeanUtil.toBean(infoDTO, MenuInfoVO.class));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.model.*;
|
||||
import com.ruoyi.common.core.page.PageVO;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.web.controller.system.vo.BatchOptStatusVO;
|
||||
import com.ruoyi.web.controller.system.vo.RoleInfoEditByStoreVO;
|
||||
import com.ruoyi.web.controller.system.vo.RoleListItemVO;
|
||||
import com.ruoyi.web.controller.system.vo.RoleQueryVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "档口角色")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/store/role")
|
||||
public class StoreRoleController extends XktBaseController {
|
||||
|
||||
final ISysRoleService roleService;
|
||||
final TokenService tokenService;
|
||||
final ISysUserService userService;
|
||||
final ISysMenuService sysMenuService;
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "角色分页查询 - 档口")
|
||||
@PostMapping("/page")
|
||||
public R<PageVO<RoleListItemVO>> pageByStore(@Validated @RequestBody RoleQueryVO vo) {
|
||||
RoleQuery query = BeanUtil.toBean(vo, RoleQuery.class);
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
if (storeId == null) {
|
||||
return R.ok(PageVO.empty(vo));
|
||||
}
|
||||
// 只能查询当前档口
|
||||
query.setStoreIds(Collections.singletonList(storeId));
|
||||
Page<UserListItem> page = PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
||||
roleService.listRole(query);
|
||||
return R.ok(PageVO.of(page, RoleListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "所有角色 - 档口")
|
||||
@PostMapping("/all")
|
||||
public R<List<RoleListItemVO>> allByStore() {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
if (storeId == null) {
|
||||
return R.ok(ListUtil.empty());
|
||||
}
|
||||
RoleQuery query = new RoleQuery();
|
||||
// 只能查询当前档口
|
||||
query.setStoreIds(Collections.singletonList(SecurityUtils.getStoreId()));
|
||||
List<RoleListItem> all = roleService.listRole(query);
|
||||
return R.ok(BeanUtil.copyToList(all, RoleListItemVO.class));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("创建角色 - 档口")
|
||||
@PostMapping("/create")
|
||||
public R<Long> createByStore(@Valid @RequestBody RoleInfoEditByStoreVO vo) {
|
||||
Assert.notNull(SecurityUtils.getStoreId());
|
||||
RoleInfoEdit dto = BeanUtil.toBean(vo, RoleInfoEdit.class);
|
||||
dto.setRoleId(null);
|
||||
dto.setStoreId(SecurityUtils.getStoreId());
|
||||
//档口的roleKey使用uuid
|
||||
dto.setRoleKey(IdUtil.fastSimpleUUID());
|
||||
Set<Long> usableMenuIds = sysMenuService.storeUsableMenuIds();
|
||||
CollUtil.emptyIfNull(dto.getMenuIds())
|
||||
.forEach(menuId -> Assert.isTrue(usableMenuIds.contains(menuId), "菜单不可用"));
|
||||
Long roleId = roleService.createRole(dto);
|
||||
return R.ok(roleId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改角色 - 档口")
|
||||
@PostMapping("/edit")
|
||||
public R<Long> editByStore(@Valid @RequestBody RoleInfoEditByStoreVO vo) {
|
||||
Assert.notNull(SecurityUtils.getStoreId());
|
||||
Assert.notNull(vo.getRoleId(), "角色ID不能为空");
|
||||
RoleInfo info = roleService.getRoleById(vo.getRoleId());
|
||||
Assert.isTrue(Objects.equals(info.getStoreId(), SecurityUtils.getStoreId()), "档口ID不匹配");
|
||||
RoleInfoEdit dto = BeanUtil.toBean(vo, RoleInfoEdit.class);
|
||||
//档口的roleKey不变
|
||||
dto.setRoleKey(info.getRoleKey());
|
||||
Set<Long> usableMenuIds = sysMenuService.storeUsableMenuIds();
|
||||
CollUtil.emptyIfNull(dto.getMenuIds())
|
||||
.forEach(menuId -> Assert.isTrue(usableMenuIds.contains(menuId), "菜单不可用"));
|
||||
InfluenceScope scope = roleService.updateRole(dto);
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(scope.getUserIds());
|
||||
return R.ok(vo.getRoleId());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改角色状态 - 档口")
|
||||
@PostMapping("/changeStatus")
|
||||
public R<Integer> changeStatusByStore(@Validated @RequestBody BatchOptStatusVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
List<RoleListItem> roles = roleService.listRole(RoleQuery.builder()
|
||||
.storeIds(Collections.singletonList(storeId)).build());
|
||||
roles.forEach(r -> Assert.isTrue(Objects.equals(r.getStoreId(), storeId), "档口ID不匹配"));
|
||||
InfluenceScope scope = roleService.batchUpdateStatus(vo.getIds(), vo.getStatus());
|
||||
if (!Constants.SYS_NORMAL_STATUS.equals(vo.getStatus())) {
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(scope.getUserIds());
|
||||
}
|
||||
return R.ok(scope.getCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.*;
|
||||
import com.ruoyi.common.core.page.PageVO;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.web.controller.system.vo.*;
|
||||
import com.ruoyi.web.controller.xkt.vo.PhoneNumberVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.UsernameVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "档口用户")
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/store/user")
|
||||
public class StoreUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "用户分页查询 - 档口")
|
||||
@PostMapping("/page")
|
||||
public R<PageVO<UserListItemVO>> pageByStore(@Validated @RequestBody UserQueryVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
UserQuery query = BeanUtil.toBean(vo, UserQuery.class);
|
||||
// 只能查询当前档口
|
||||
query.setStoreIds(Collections.singletonList(storeId));
|
||||
Page<UserListItem> page = PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
||||
userService.listUser(query);
|
||||
return R.ok(PageVO.of(page, UserListItemVO.class));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "用户详情 - 档口")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R<UserInfoVO> getInfoByStore(@PathVariable("id") Long id) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
UserInfo infoDTO = userService.getUserById(id);
|
||||
boolean access = CollUtil.emptyIfNull(infoDTO.getRoles())
|
||||
.stream()
|
||||
.anyMatch(o -> Objects.equals(o.getStoreId(), storeId));
|
||||
if (!access) {
|
||||
return R.ok();
|
||||
}
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
UserInfoVO vo = BeanUtil.toBean(infoDTO, UserInfoVO.class);
|
||||
// 只展示当前档口角色
|
||||
vo.setRoles(CollUtil.emptyIfNull(vo.getRoles())
|
||||
.stream()
|
||||
.filter(r -> subRoleIds.contains(r.getRoleId()))
|
||||
.collect(Collectors.toList()));
|
||||
vo.setRoleIds(vo.getRoles().stream().map(RoleInfoVO::getRoleId).collect(Collectors.toList()));
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "发送子账号创建短信验证码 - 档口")
|
||||
@PostMapping("/sendSmsVerificationCode")
|
||||
public R sendSmsVerificationCode(@Validated @RequestBody PhoneNumberVO vo) {
|
||||
loginService.sendSmsVerificationCode(vo.getPhoneNumber(), false, null, null);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("创建用户 - 档口")
|
||||
@PostMapping("/create")
|
||||
public R<Long> createByStore(@Valid @RequestBody UserInfoEditByStoreVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
Assert.notEmpty(vo.getPhonenumber(), "手机号不能为空");
|
||||
Assert.notEmpty(vo.getUserName(), "账号名称不能为空");
|
||||
//短信验证码
|
||||
loginService.validateSmsVerificationCode(vo.getPhonenumber(), vo.getCode());
|
||||
UserInfoEdit dto = BeanUtil.toBean(vo, UserInfoEdit.class);
|
||||
dto.setUserId(null);
|
||||
//昵称默认手机号
|
||||
dto.setNickName(dto.getPhonenumber());
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
if (CollUtil.isEmpty(dto.getRoleIds())) {
|
||||
dto.setRoleIds(Collections.singletonList(ESystemRole.SELLER.getId()));
|
||||
} else {
|
||||
dto.getRoleIds().forEach(roleId -> Assert.isTrue(subRoleIds.contains(roleId), "角色非法"));
|
||||
dto.getRoleIds().add(ESystemRole.SELLER.getId());
|
||||
}
|
||||
Long userId = userService.createUser(dto);
|
||||
return R.ok(userId);
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改用户 - 档口")
|
||||
@PostMapping("/edit")
|
||||
public R<Long> editByStore(@Valid @RequestBody UserInfoEditByStoreVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
Assert.notEmpty(vo.getPhonenumber(), "用户手机号不能为空");
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
UserInfo info = userService.getUserByPhoneNumber(vo.getPhonenumber());
|
||||
Assert.notNull(info, "用户不存在");
|
||||
List<Long> roleIds = new ArrayList<>();
|
||||
List<Long> csRoleIds = new ArrayList<>();
|
||||
for (RoleInfo roleInfo : CollUtil.emptyIfNull(info.getRoles())) {
|
||||
if (subRoleIds.contains(roleInfo.getRoleId())) {
|
||||
csRoleIds.add(roleInfo.getRoleId());
|
||||
} else {
|
||||
roleIds.add(roleInfo.getRoleId());
|
||||
}
|
||||
}
|
||||
if (csRoleIds.isEmpty()) {
|
||||
//原来不是当前档口子账号,校验短信验证码
|
||||
loginService.validateSmsVerificationCode(vo.getPhonenumber(), vo.getCode());
|
||||
}
|
||||
UserInfoEdit dto = BeanUtil.toBean(info, UserInfoEdit.class);
|
||||
roleIds.addAll(CollUtil.emptyIfNull(vo.getRoleIds()));
|
||||
dto.setRoleIds(roleIds);
|
||||
Long userId = userService.updateUser(dto);
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(userId);
|
||||
return R.ok(userId);
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改用户状态 - 档口")
|
||||
@PostMapping("/changeStatus")
|
||||
public R<Integer> changeStatusByStore(@Validated @RequestBody BatchOptStatusVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
Assert.isTrue(vo.getIds().size() == 1, "档口不支持同时修改多个用户的状态");
|
||||
UserInfo info = userService.getUserById(vo.getIds().get(0));
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
boolean accessOpt = CollUtil.emptyIfNull(info.getRoles())
|
||||
.stream()
|
||||
.anyMatch(roleInfo -> subRoleIds.contains(roleInfo.getRoleId()));
|
||||
Assert.isTrue(accessOpt, "当前角色无权修改用户状态");
|
||||
int count = userService.batchUpdateUserStatus(vo.getIds(), vo.getStatus());
|
||||
if (!Constants.SYS_NORMAL_STATUS.equals(vo.getStatus())) {
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(vo.getIds());
|
||||
}
|
||||
return R.ok(count);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "手机号是否已注册")
|
||||
@PostMapping("/isPhoneNumberRegistered")
|
||||
public R<Boolean> isPhoneNumberRegistered(@Validated @RequestBody PhoneNumberVO phoneNumberVO) {
|
||||
SysUser u = new SysUser();
|
||||
u.setPhonenumber(phoneNumberVO.getPhoneNumber());
|
||||
boolean unique = userService.checkPhoneUnique(u);
|
||||
return R.ok(!unique);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "账号名称是否已注册")
|
||||
@PostMapping("/isUsernameRegistered")
|
||||
public R<Boolean> isUsernameRegistered(@Validated @RequestBody UsernameVO usernameVO) {
|
||||
SysUser u = new SysUser();
|
||||
u.setUserName(usernameVO.getUserName());
|
||||
boolean unique = userService.checkUserNameUnique(u);
|
||||
return R.ok(!unique);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
|
|
@ -21,17 +20,14 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "系统菜单/档口菜单")
|
||||
@Api(tags = "系统菜单")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/sys/menu")
|
||||
|
|
@ -59,34 +55,6 @@ public class SysMenuController extends XktBaseController {
|
|||
return R.ok(BeanUtil.copyToList(tree, MenuTreeNodeVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "菜单列表查询 - 档口")
|
||||
@PostMapping("/store/list")
|
||||
public R<List<MenuListItemVO>> listByStore(@Validated @RequestBody MenuQueryVO vo) {
|
||||
MenuQuery query = BeanUtil.toBean(vo, MenuQuery.class);
|
||||
Set<Long> usableMenuIds = menuService.storeUsableMenuIds();
|
||||
List<MenuListItem> list = menuService.listMenu(query)
|
||||
.stream()
|
||||
.filter(o->usableMenuIds.contains(o.getMenuId()))
|
||||
.collect(Collectors.toList());
|
||||
return R.ok(BeanUtil.copyToList(list, MenuListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "菜单树查询 - 档口")
|
||||
@PostMapping("/store/tree")
|
||||
public R<List<MenuTreeNodeVO>> treeByStore(@Validated @RequestBody MenuQueryVO vo) {
|
||||
MenuQuery query = BeanUtil.toBean(vo, MenuQuery.class);
|
||||
Set<Long> usableMenuIds = menuService.storeUsableMenuIds();
|
||||
if (CollUtil.isNotEmpty(query.getMenuIds())) {
|
||||
query.setMenuIds(new ArrayList<>(CollUtil.intersection(usableMenuIds, query.getMenuIds())));
|
||||
} else {
|
||||
query.setMenuIds(new ArrayList<>(usableMenuIds));
|
||||
}
|
||||
List<MenuTreeNode> tree = menuService.getMenuTree(query);
|
||||
return R.ok(BeanUtil.copyToList(tree, MenuTreeNodeVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "菜单详情")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R<MenuInfoVO> getInfo(@PathVariable("id") Long id) {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ package com.ruoyi.web.controller.system;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
|
|
@ -14,7 +12,6 @@ import com.ruoyi.common.core.domain.R;
|
|||
import com.ruoyi.common.core.domain.model.*;
|
||||
import com.ruoyi.common.core.page.PageVO;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
|
@ -31,10 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -42,7 +36,7 @@ import java.util.stream.Collectors;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "系统角色/档口子角色")
|
||||
@Api(tags = "系统角色")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/sys/role")
|
||||
|
|
@ -71,39 +65,8 @@ public class SysRoleController extends XktBaseController {
|
|||
return R.ok(BeanUtil.copyToList(all, RoleListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "角色分页查询 - 档口")
|
||||
@PostMapping("/store/page")
|
||||
public R<PageVO<RoleListItemVO>> pageByStore(@Validated @RequestBody RoleQueryVO vo) {
|
||||
RoleQuery query = BeanUtil.toBean(vo, RoleQuery.class);
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
if (storeId == null) {
|
||||
return R.ok(PageVO.empty(vo));
|
||||
}
|
||||
// 只能查询当前档口
|
||||
query.setStoreIds(Collections.singletonList(storeId));
|
||||
Page<UserListItem> page = PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
||||
roleService.listRole(query);
|
||||
return R.ok(PageVO.of(page, RoleListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "所有角色 - 档口")
|
||||
@PostMapping("/store/all")
|
||||
public R<List<RoleListItemVO>> allByStore() {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
if (storeId == null) {
|
||||
return R.ok(ListUtil.empty());
|
||||
}
|
||||
RoleQuery query = new RoleQuery();
|
||||
// 只能查询当前档口
|
||||
query.setStoreIds(Collections.singletonList(SecurityUtils.getStoreId()));
|
||||
List<RoleListItem> all = roleService.listRole(query);
|
||||
return R.ok(BeanUtil.copyToList(all, RoleListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')")
|
||||
@ApiOperation(value = "角色详情 - 管理员/档口")
|
||||
@ApiOperation(value = "角色详情 - 管理员")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R<RoleInfoVO> getInfo(@PathVariable("id") Long id) {
|
||||
RoleInfo infoDTO = roleService.getRoleById(id);
|
||||
|
|
@ -124,24 +87,6 @@ public class SysRoleController extends XktBaseController {
|
|||
return R.ok(roleId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("创建角色 - 档口")
|
||||
@PostMapping("/store/create")
|
||||
public R<Long> createByStore(@Valid @RequestBody RoleInfoEditByStoreVO vo) {
|
||||
Assert.notNull(SecurityUtils.getStoreId());
|
||||
RoleInfoEdit dto = BeanUtil.toBean(vo, RoleInfoEdit.class);
|
||||
dto.setRoleId(null);
|
||||
dto.setStoreId(SecurityUtils.getStoreId());
|
||||
//档口的roleKey使用uuid
|
||||
dto.setRoleKey(IdUtil.fastSimpleUUID());
|
||||
Set<Long> usableMenuIds = sysMenuService.storeUsableMenuIds();
|
||||
CollUtil.emptyIfNull(dto.getMenuIds())
|
||||
.forEach(menuId -> Assert.isTrue(usableMenuIds.contains(menuId), "菜单不可用"));
|
||||
Long roleId = roleService.createRole(dto);
|
||||
return R.ok(roleId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改角色 - 管理员")
|
||||
|
|
@ -155,27 +100,6 @@ public class SysRoleController extends XktBaseController {
|
|||
return R.ok(vo.getRoleId());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改角色 - 档口")
|
||||
@PostMapping("/store/edit")
|
||||
public R<Long> editByStore(@Valid @RequestBody RoleInfoEditByStoreVO vo) {
|
||||
Assert.notNull(SecurityUtils.getStoreId());
|
||||
Assert.notNull(vo.getRoleId(), "角色ID不能为空");
|
||||
RoleInfo info = roleService.getRoleById(vo.getRoleId());
|
||||
Assert.isTrue(Objects.equals(info.getStoreId(), SecurityUtils.getStoreId()), "档口ID不匹配");
|
||||
RoleInfoEdit dto = BeanUtil.toBean(vo, RoleInfoEdit.class);
|
||||
//档口的roleKey不变
|
||||
dto.setRoleKey(info.getRoleKey());
|
||||
Set<Long> usableMenuIds = sysMenuService.storeUsableMenuIds();
|
||||
CollUtil.emptyIfNull(dto.getMenuIds())
|
||||
.forEach(menuId -> Assert.isTrue(usableMenuIds.contains(menuId), "菜单不可用"));
|
||||
InfluenceScope scope = roleService.updateRole(dto);
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(scope.getUserIds());
|
||||
return R.ok(vo.getRoleId());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@ApiOperation("导出 - 管理员")
|
||||
|
|
@ -198,22 +122,6 @@ public class SysRoleController extends XktBaseController {
|
|||
return R.ok(scope.getCount());
|
||||
}
|
||||
|
||||
// @PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
// @Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
// @ApiOperation("删除角色 - 档口")
|
||||
// @PostMapping("/store/remove")
|
||||
public R<Integer> removeByStore(@Validated @RequestBody IdsVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
List<RoleListItem> roles = roleService.listRole(RoleQuery.builder()
|
||||
.storeIds(Collections.singletonList(storeId)).build());
|
||||
roles.forEach(r -> Assert.isTrue(Objects.equals(r.getStoreId(), storeId), "档口ID不匹配"));
|
||||
InfluenceScope scope = roleService.batchDelete(vo.getIds());
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(scope.getUserIds());
|
||||
return R.ok(scope.getCount());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改角色状态 - 管理员")
|
||||
|
|
@ -227,22 +135,4 @@ public class SysRoleController extends XktBaseController {
|
|||
return R.ok(scope.getCount());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改角色状态 - 档口")
|
||||
@PostMapping("/store/changeStatus")
|
||||
public R<Integer> changeStatusByStore(@Validated @RequestBody BatchOptStatusVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
List<RoleListItem> roles = roleService.listRole(RoleQuery.builder()
|
||||
.storeIds(Collections.singletonList(storeId)).build());
|
||||
roles.forEach(r -> Assert.isTrue(Objects.equals(r.getStoreId(), storeId), "档口ID不匹配"));
|
||||
InfluenceScope scope = roleService.batchUpdateStatus(vo.getIds(), vo.getStatus());
|
||||
if (!Constants.SYS_NORMAL_STATUS.equals(vo.getStatus())) {
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(scope.getUserIds());
|
||||
}
|
||||
return R.ok(scope.getCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,12 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.*;
|
||||
import com.ruoyi.common.core.domain.model.UserInfo;
|
||||
import com.ruoyi.common.core.domain.model.UserInfoEdit;
|
||||
import com.ruoyi.common.core.domain.model.UserListItem;
|
||||
import com.ruoyi.common.core.domain.model.UserQuery;
|
||||
import com.ruoyi.common.core.page.PageVO;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
|
|
@ -34,7 +36,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -42,7 +44,7 @@ import java.util.stream.Collectors;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "系统用户/档口子用户")
|
||||
@Api(tags = "系统用户")
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/sys/user")
|
||||
public class SysUserController extends BaseController {
|
||||
|
|
@ -66,20 +68,6 @@ public class SysUserController extends BaseController {
|
|||
return R.ok(PageVO.of(page, UserListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "用户分页查询 - 档口")
|
||||
@PostMapping("/store/page")
|
||||
public R<PageVO<UserListItemVO>> pageByStore(@Validated @RequestBody UserQueryVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
UserQuery query = BeanUtil.toBean(vo, UserQuery.class);
|
||||
// 只能查询当前档口
|
||||
query.setStoreIds(Collections.singletonList(storeId));
|
||||
Page<UserListItem> page = PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
||||
userService.listUser(query);
|
||||
return R.ok(PageVO.of(page, UserListItemVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "用户详情 - 管理员")
|
||||
@GetMapping(value = "/{id}")
|
||||
|
|
@ -91,30 +79,6 @@ public class SysUserController extends BaseController {
|
|||
return R.ok(vo);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "用户详情 - 档口")
|
||||
@GetMapping(value = "/store/{id}")
|
||||
public R<UserInfoVO> getInfoByStore(@PathVariable("id") Long id) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
UserInfo infoDTO = userService.getUserById(id);
|
||||
boolean access = CollUtil.emptyIfNull(infoDTO.getRoles())
|
||||
.stream()
|
||||
.anyMatch(o -> Objects.equals(o.getStoreId(), storeId));
|
||||
if (!access) {
|
||||
return R.ok();
|
||||
}
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
UserInfoVO vo = BeanUtil.toBean(infoDTO, UserInfoVO.class);
|
||||
// 只展示当前档口角色
|
||||
vo.setRoles(CollUtil.emptyIfNull(vo.getRoles())
|
||||
.stream()
|
||||
.filter(r -> subRoleIds.contains(r.getRoleId()))
|
||||
.collect(Collectors.toList()));
|
||||
vo.setRoleIds(vo.getRoles().stream().map(RoleInfoVO::getRoleId).collect(Collectors.toList()));
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("创建用户 - 管理员")
|
||||
|
|
@ -126,40 +90,6 @@ public class SysUserController extends BaseController {
|
|||
return R.ok(userId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@ApiOperation(value = "发送子账号创建短信验证码 - 档口")
|
||||
@PostMapping("/store/sendSmsVerificationCode")
|
||||
public R sendSmsVerificationCode(@Validated @RequestBody PhoneNumberVO vo) {
|
||||
loginService.sendSmsVerificationCode(vo.getPhoneNumber(), false, null, null);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("创建用户 - 档口")
|
||||
@PostMapping("/store/create")
|
||||
public R<Long> createByStore(@Valid @RequestBody UserInfoEditByStoreVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
Assert.notEmpty(vo.getPhonenumber(), "手机号不能为空");
|
||||
Assert.notEmpty(vo.getUserName(), "账号名称不能为空");
|
||||
//短信验证码
|
||||
loginService.validateSmsVerificationCode(vo.getPhonenumber(), vo.getCode());
|
||||
UserInfoEdit dto = BeanUtil.toBean(vo, UserInfoEdit.class);
|
||||
dto.setUserId(null);
|
||||
//昵称默认手机号
|
||||
dto.setNickName(dto.getPhonenumber());
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
if (CollUtil.isEmpty(dto.getRoleIds())) {
|
||||
dto.setRoleIds(Collections.singletonList(ESystemRole.SELLER.getId()));
|
||||
} else {
|
||||
dto.getRoleIds().forEach(roleId -> Assert.isTrue(subRoleIds.contains(roleId), "角色非法"));
|
||||
dto.getRoleIds().add(ESystemRole.SELLER.getId());
|
||||
}
|
||||
Long userId = userService.createUser(dto);
|
||||
return R.ok(userId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改用户 - 管理员")
|
||||
|
|
@ -173,39 +103,6 @@ public class SysUserController extends BaseController {
|
|||
return R.ok(userId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改用户 - 档口")
|
||||
@PostMapping("/store/edit")
|
||||
public R<Long> editByStore(@Valid @RequestBody UserInfoEditByStoreVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
Assert.notEmpty(vo.getPhonenumber(), "用户手机号不能为空");
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
UserInfo info = userService.getUserByPhoneNumber(vo.getPhonenumber());
|
||||
Assert.notNull(info, "用户不存在");
|
||||
List<Long> roleIds = new ArrayList<>();
|
||||
List<Long> csRoleIds = new ArrayList<>();
|
||||
for (RoleInfo roleInfo : CollUtil.emptyIfNull(info.getRoles())) {
|
||||
if (subRoleIds.contains(roleInfo.getRoleId())) {
|
||||
csRoleIds.add(roleInfo.getRoleId());
|
||||
} else {
|
||||
roleIds.add(roleInfo.getRoleId());
|
||||
}
|
||||
}
|
||||
if (csRoleIds.isEmpty()) {
|
||||
//原来不是当前档口子账号,校验短信验证码
|
||||
loginService.validateSmsVerificationCode(vo.getPhonenumber(), vo.getCode());
|
||||
}
|
||||
UserInfoEdit dto = BeanUtil.toBean(info, UserInfoEdit.class);
|
||||
roleIds.addAll(CollUtil.emptyIfNull(vo.getRoleIds()));
|
||||
dto.setRoleIds(roleIds);
|
||||
Long userId = userService.updateUser(dto);
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(userId);
|
||||
return R.ok(userId);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@ApiOperation("导出 - 管理员")
|
||||
|
|
@ -262,28 +159,6 @@ public class SysUserController extends BaseController {
|
|||
return R.ok(count);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('store')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改用户状态 - 档口")
|
||||
@PostMapping("/store/changeStatus")
|
||||
public R<Integer> changeStatusByStore(@Validated @RequestBody BatchOptStatusVO vo) {
|
||||
Long storeId = SecurityUtils.getStoreId();
|
||||
Assert.notNull(storeId);
|
||||
Assert.isTrue(vo.getIds().size() == 1, "档口不支持同时修改多个用户的状态");
|
||||
UserInfo info = userService.getUserById(vo.getIds().get(0));
|
||||
Set<Long> subRoleIds = roleService.getSubRoleIdsByStore(storeId);
|
||||
boolean accessOpt = CollUtil.emptyIfNull(info.getRoles())
|
||||
.stream()
|
||||
.anyMatch(roleInfo -> subRoleIds.contains(roleInfo.getRoleId()));
|
||||
Assert.isTrue(accessOpt, "当前角色无权修改用户状态");
|
||||
int count = userService.batchUpdateUserStatus(vo.getIds(), vo.getStatus());
|
||||
if (!Constants.SYS_NORMAL_STATUS.equals(vo.getStatus())) {
|
||||
// 清除用户缓存(退出登录)
|
||||
tokenService.deleteCacheUser(vo.getIds());
|
||||
}
|
||||
return R.ok(count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue