|
|
@ -1,18 +1,5 @@
|
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
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.DeleteMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
@ -30,6 +17,16 @@ import com.ruoyi.system.domain.SysUserRole;
|
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
|
import com.ruoyi.system.service.ISysRoleService;
|
|
|
|
import com.ruoyi.system.service.ISysRoleService;
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
|
|
|
|
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.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.StringJoiner;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 角色信息
|
|
|
|
* 角色信息
|
|
|
@ -244,6 +241,23 @@ public class SysRoleController extends BaseController
|
|
|
|
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
|
|
|
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
roleService.checkRoleDataScope(roleId);
|
|
|
|
roleService.checkRoleDataScope(roleId);
|
|
|
|
|
|
|
|
// 当授权成为仓库管理员前先判断此用户是否是物资管理员(必须先为物资管理员,才可成为仓库管理员)
|
|
|
|
|
|
|
|
StringJoiner joiner = new StringJoiner(",");
|
|
|
|
|
|
|
|
if (roleId == 102L) {
|
|
|
|
|
|
|
|
// 根据userIds查询用户信息
|
|
|
|
|
|
|
|
List<SysUser> userList = userService.listUser(Arrays.asList(userIds));
|
|
|
|
|
|
|
|
for (SysUser user : userList) {
|
|
|
|
|
|
|
|
List<Long> roleIds = user.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (!roleIds.contains(107L)) {
|
|
|
|
|
|
|
|
// 如果不是物资管理员那么不能授权成为仓库管理员,记录一下不能成为仓库管理员的用户名
|
|
|
|
|
|
|
|
joiner.add(user.getNickName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (joiner.toString().length() != 0) {
|
|
|
|
|
|
|
|
return AjaxResult.error(joiner.toString() + "不是物资管理员,因此不能成为仓库管理员!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
|
|
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|