Merge remote-tracking branch 'origin/main' into main
# Conflicts: # bonus-modules/bonus-system/src/main/java/com/bonus/system/service/impl/SysDeptServiceImpl.java
This commit is contained in:
commit
5f786cd3db
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-api</artifactId>
|
<artifactId>bonus-api</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,9 @@ public interface RemoteUserService
|
||||||
@GetMapping(value = "/user/{userId}")
|
@GetMapping(value = "/user/{userId}")
|
||||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
@GetMapping(value = "/user/ids/{userIds}")
|
||||||
|
public AjaxResult getUsers(@PathVariable("userIds") Long[] userIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
@PostMapping("/user/")
|
@PostMapping("/user/")
|
||||||
public AjaxResult add(@Validated @RequestBody SysUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public AjaxResult add(@Validated @RequestBody SysUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
|
@ -127,6 +130,15 @@ public interface RemoteUserService
|
||||||
@GetMapping("/user/deptTree")
|
@GetMapping("/user/deptTree")
|
||||||
public AjaxResult deptTree(SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public AjaxResult deptTree(SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录用户数据权限范围内的部门权限下的部门人员树列表
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @param source 请求来源
|
||||||
|
* @return 部门人员树列表或失败消息
|
||||||
|
*/
|
||||||
|
@GetMapping("/user/deptUserTree")
|
||||||
|
public AjaxResult deptUserTree(SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户审批状态
|
* 修改用户审批状态
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,18 @@ public class SysDept extends BaseEntity
|
||||||
/** 子部门 */
|
/** 子部门 */
|
||||||
private List<SysDept> children = new ArrayList<SysDept>();
|
private List<SysDept> children = new ArrayList<SysDept>();
|
||||||
|
|
||||||
|
private List<SysUser> sysUsers;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
public Integer getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(Integer level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getDeptId()
|
public Long getDeptId()
|
||||||
{
|
{
|
||||||
return deptId;
|
return deptId;
|
||||||
|
|
@ -181,6 +193,14 @@ public class SysDept extends BaseEntity
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SysUser> getSysUsers() {
|
||||||
|
return sysUsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSysUsers(List<SysUser> sysUsers) {
|
||||||
|
this.sysUsers = sysUsers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
@ -198,6 +218,7 @@ public class SysDept extends BaseEntity
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("level", getLevel())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
return AjaxResult.error("根据用户编号获取详细信息,用户权限内的角色和权限集合失败:" + throwable.getMessage());
|
return AjaxResult.error("根据用户编号获取详细信息,用户权限内的角色和权限集合失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getUsers(Long[] userIds, String source) {
|
||||||
|
return AjaxResult.error("根据用户编号列表获取用户列表,用户权限内的角色和权限集合失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult add(SysUser user, String source) {
|
public AjaxResult add(SysUser user, String source) {
|
||||||
return AjaxResult.error("新增用户失败:" + throwable.getMessage());
|
return AjaxResult.error("新增用户失败:" + throwable.getMessage());
|
||||||
|
|
@ -95,6 +100,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
return AjaxResult.error("获取部门权限下的部门树列表:" + throwable.getMessage());
|
return AjaxResult.error("获取部门权限下的部门树列表:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult deptUserTree(SysDept dept, String source) {
|
||||||
|
return AjaxResult.error("获取部门权限下的部门人员树列表:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult approvalStatus(SysUser user, String source) {
|
public AjaxResult approvalStatus(SysUser user, String source) {
|
||||||
return AjaxResult.error("修改用户审批状态失败:" + throwable.getMessage());
|
return AjaxResult.error("修改用户审批状态失败:" + throwable.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus</artifactId>
|
<artifactId>bonus</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus</artifactId>
|
<artifactId>bonus</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
package com.bonus.common.security.auth;
|
package com.bonus.common.security.auth;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import com.bonus.common.core.constant.SecurityConstants;
|
import com.bonus.common.core.constant.SecurityConstants;
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
|
@ -146,6 +144,20 @@ public class AuthLogic
|
||||||
*/
|
*/
|
||||||
public void checkPermi(RequiresPermissions requiresPermissions, ProceedingJoinPoint joinPoint)
|
public void checkPermi(RequiresPermissions requiresPermissions, ProceedingJoinPoint joinPoint)
|
||||||
{
|
{
|
||||||
|
//获取请求参数
|
||||||
|
boolean needPermission = true;
|
||||||
|
Object[] args = joinPoint.getArgs();
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
Object obj = args[i];
|
||||||
|
if (Objects.nonNull(obj) && obj instanceof JSONObject) {
|
||||||
|
JSONObject jsonObject = (JSONObject) obj;
|
||||||
|
if ("1".equals(jsonObject.getStr("skipPermission"))) {
|
||||||
|
needPermission = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needPermission) {
|
||||||
SecurityContextHolder.setPermission(StringUtils.join(requiresPermissions.value(), ","));
|
SecurityContextHolder.setPermission(StringUtils.join(requiresPermissions.value(), ","));
|
||||||
if (requiresPermissions.logical() == Logical.AND) {
|
if (requiresPermissions.logical() == Logical.AND) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -159,6 +171,7 @@ public class AuthLogic
|
||||||
checkPermiOr(requiresPermissions.value());
|
checkPermiOr(requiresPermissions.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-common</artifactId>
|
<artifactId>bonus-common</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus</artifactId>
|
<artifactId>bonus</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus</artifactId>
|
<artifactId>bonus</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-modules</artifactId>
|
<artifactId>bonus-modules</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-modules</artifactId>
|
<artifactId>bonus-modules</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-modules</artifactId>
|
<artifactId>bonus-modules</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-modules</artifactId>
|
<artifactId>bonus-modules</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,9 +117,8 @@ public class SysDictDataController extends BaseController
|
||||||
return toAjax(dictDataService.insertDictData(dict));
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.toString(),e);
|
log.error(e.toString(),e);
|
||||||
|
return error("系统错误, " + e.getMessage());
|
||||||
}
|
}
|
||||||
return error("系统错误");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -134,9 +133,8 @@ public class SysDictDataController extends BaseController
|
||||||
return toAjax(dictDataService.updateDictData(dict));
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.toString(),e);
|
log.error(e.toString(),e);
|
||||||
|
return error("系统错误, " + e.getMessage());
|
||||||
}
|
}
|
||||||
return error("系统错误");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,24 @@ public class SysUserController extends BaseController {
|
||||||
return error("系统异常,请联系管理员");
|
return error("系统异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号列表获取用户列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:query"))
|
||||||
|
@GetMapping("/ids/{userIds}")
|
||||||
|
@SysLog(title = "用户管理", businessType = OperaType.QUERY, logType = 0, module = "系统管理->用户管理", details = "根据ids获取用户列表")
|
||||||
|
public AjaxResult getUsers(@PathVariable("userIds") Long[] userIds) {
|
||||||
|
try {
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
List<SysUser> sysUsers = userService.selectUsersByIds(userIds);
|
||||||
|
ajax.put(AjaxResult.DATA_TAG, sysUsers);
|
||||||
|
return ajax;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.toString(), e);
|
||||||
|
}
|
||||||
|
return error("系统异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增用户
|
* 新增用户
|
||||||
*/
|
*/
|
||||||
|
|
@ -394,6 +412,21 @@ public class SysUserController extends BaseController {
|
||||||
return error("系统异常,请联系管理员");
|
return error("系统异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门人员树列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:list"))
|
||||||
|
@GetMapping("/deptUserTree")
|
||||||
|
public AjaxResult deptUserTree(SysDept dept) {
|
||||||
|
try {
|
||||||
|
return success(deptService.selectDeptUserTreeList(dept));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.toString(), e);
|
||||||
|
}
|
||||||
|
return error("系统异常,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户审批状态
|
* 修改用户审批状态
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.bonus.system.api.domain.SysMenu;
|
import com.bonus.system.api.domain.SysMenu;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.bonus.system.api.domain.SysDept;
|
import com.bonus.system.api.domain.SysDept;
|
||||||
|
|
||||||
|
|
@ -21,6 +22,9 @@ public class TreeSelect implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/** 父部门ID */
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点名称
|
* 节点名称
|
||||||
*/
|
*/
|
||||||
|
|
@ -28,6 +32,10 @@ public class TreeSelect implements Serializable {
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
private List<SysUser> sysUsers;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子节点
|
* 子节点
|
||||||
|
|
@ -41,8 +49,11 @@ public class TreeSelect implements Serializable {
|
||||||
|
|
||||||
public TreeSelect(SysDept dept) {
|
public TreeSelect(SysDept dept) {
|
||||||
this.id = dept.getDeptId();
|
this.id = dept.getDeptId();
|
||||||
|
this.parentId = dept.getParentId();
|
||||||
this.status = dept.getStatus();
|
this.status = dept.getStatus();
|
||||||
this.label = dept.getDeptName();
|
this.label = dept.getDeptName();
|
||||||
|
this.sysUsers = dept.getSysUsers();
|
||||||
|
this.level = dept.getLevel();
|
||||||
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,6 +64,14 @@ public class TreeSelect implements Serializable {
|
||||||
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(Integer level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
@ -61,6 +80,14 @@ public class TreeSelect implements Serializable {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
@ -84,4 +111,12 @@ public class TreeSelect implements Serializable {
|
||||||
public void setStatus(String status) {
|
public void setStatus(String status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SysUser> getSysUsers() {
|
||||||
|
return sysUsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSysUsers(List<SysUser> sysUsers) {
|
||||||
|
this.sysUsers = sysUsers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.system.api.domain.SysDept;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
|
|
||||||
|
|
@ -52,6 +53,14 @@ public interface SysUserMapper {
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserById(Long userId);
|
public SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量查询用户
|
||||||
|
*
|
||||||
|
* @param userIds 用户ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public List<SysUser> selectUsersByIds(Long[] userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增用户信息
|
* 新增用户信息
|
||||||
*
|
*
|
||||||
|
|
@ -127,4 +136,11 @@ public interface SysUserMapper {
|
||||||
public SysUser checkEmailUnique(String email);
|
public SysUser checkEmailUnique(String email);
|
||||||
|
|
||||||
Integer approvalStatus(Long userId);
|
Integer approvalStatus(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织人员树
|
||||||
|
* @param dept
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysDept> getTree(SysDept dept);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,14 @@ public interface ISysDeptService
|
||||||
*/
|
*/
|
||||||
public List<TreeSelect> selectDeptTreeList(SysDept dept);
|
public List<TreeSelect> selectDeptTreeList(SysDept dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门人员树结构信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 部门树信息集合
|
||||||
|
*/
|
||||||
|
public List<TreeSelect> selectDeptUserTreeList(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,14 @@ public interface ISysUserService
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserById(Long userId);
|
public SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量查询用户
|
||||||
|
*
|
||||||
|
* @param userIds 用户ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
List<SysUser> selectUsersByIds(Long[] userIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询用户所属角色组
|
* 根据用户ID查询用户所属角色组
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
package com.bonus.system.service.impl;
|
package com.bonus.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.common.security.utils.DictUtils;
|
import com.bonus.common.security.utils.DictUtils;
|
||||||
import com.bonus.system.api.domain.SysDictData;
|
import com.bonus.system.api.domain.SysDictData;
|
||||||
import com.bonus.system.mapper.SysDictDataMapper;
|
import com.bonus.system.mapper.SysDictDataMapper;
|
||||||
import com.bonus.system.service.ISysDictDataService;
|
import com.bonus.system.service.ISysDictDataService;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典 业务层处理
|
* 字典 业务层处理
|
||||||
|
|
@ -82,6 +87,9 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||||
@Override
|
@Override
|
||||||
public int insertDictData(SysDictData data)
|
public int insertDictData(SysDictData data)
|
||||||
{
|
{
|
||||||
|
if (checkIfDictValueOrLabelAreRepeat(data)) {
|
||||||
|
throw new ServiceException("发现重复字典标签或字典键值");
|
||||||
|
}
|
||||||
int row = dictDataMapper.insertDictData(data);
|
int row = dictDataMapper.insertDictData(data);
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -100,6 +108,9 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||||
@Override
|
@Override
|
||||||
public int updateDictData(SysDictData data)
|
public int updateDictData(SysDictData data)
|
||||||
{
|
{
|
||||||
|
if (checkIfDictValueOrLabelAreRepeat(data)) {
|
||||||
|
throw new ServiceException("发现重复字典标签或字典键值");
|
||||||
|
}
|
||||||
int row = dictDataMapper.updateDictData(data);
|
int row = dictDataMapper.updateDictData(data);
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -108,4 +119,27 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查同一个字典类型里是否有相同的字典键值和字典标签
|
||||||
|
*
|
||||||
|
* @param data 字典数据信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean checkIfDictValueOrLabelAreRepeat(SysDictData data) {
|
||||||
|
boolean result = false;
|
||||||
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
|
List<SysDictData> filteredItems = dictDatas.stream().collect(Collectors.toList());
|
||||||
|
if (Objects.nonNull(data.getDictCode())) {
|
||||||
|
filteredItems = dictDatas.stream().filter(item -> !data.getDictCode().equals(item.getDictCode())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(filteredItems)) {
|
||||||
|
for (SysDictData dictData : filteredItems) {
|
||||||
|
if (dictData.getDictLabel().equals(data.getDictLabel()) || dictData.getDictValue().equals(data.getDictValue())) {
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,16 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||||
return userMapper.selectUserById(userId);
|
return userMapper.selectUserById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量查询用户
|
||||||
|
*
|
||||||
|
* @param userIds 用户ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public List<SysUser> selectUsersByIds(Long[] userIds) {
|
||||||
|
return userMapper.selectUsersByIds(userIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户所属角色组
|
* 查询用户所属角色组
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,14 @@
|
||||||
where u.user_id = #{userId}
|
where u.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUsersByIds" parameterType="Long" resultMap="SysUserResult">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
where u.user_id in
|
||||||
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
|
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
select user_id, user_name
|
select user_id, user_name
|
||||||
from sys_user
|
from sys_user
|
||||||
|
|
@ -198,6 +206,69 @@
|
||||||
and del_flag = '0' limit 1
|
and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTree" resultType="com.bonus.system.api.domain.SysDept">
|
||||||
|
WITH RECURSIVE DeptHierarchy AS (
|
||||||
|
SELECT
|
||||||
|
deptId,
|
||||||
|
parentId,
|
||||||
|
deptName,
|
||||||
|
0 AS level -- 初始级别为 0
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
d.dept_id AS deptId,
|
||||||
|
d.parent_id AS parentId,
|
||||||
|
d.dept_name AS deptName
|
||||||
|
FROM sys_dept d
|
||||||
|
WHERE d.del_flag = '0'
|
||||||
|
AND d.STATUS = '0'
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
su.user_id AS deptId,
|
||||||
|
su.dept_id AS parentId,
|
||||||
|
su.nick_name AS deptName
|
||||||
|
FROM sys_user su
|
||||||
|
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||||
|
WHERE su.del_flag = '0'
|
||||||
|
) AS combined_results
|
||||||
|
WHERE parentId = 0 -- 选择根级别(parentId 为 0)
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
cr.deptId,
|
||||||
|
cr.parentId,
|
||||||
|
cr.deptName,
|
||||||
|
ch.level + 1 -- 级别递增
|
||||||
|
FROM DeptHierarchy ch
|
||||||
|
JOIN (
|
||||||
|
SELECT
|
||||||
|
d.dept_id AS deptId,
|
||||||
|
d.parent_id AS parentId,
|
||||||
|
d.dept_name AS deptName
|
||||||
|
FROM sys_dept d
|
||||||
|
WHERE d.del_flag = '0'
|
||||||
|
AND d.STATUS = '0'
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
su.user_id AS deptId,
|
||||||
|
su.dept_id AS parentId,
|
||||||
|
su.nick_name AS deptName
|
||||||
|
FROM sys_user su
|
||||||
|
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||||
|
WHERE su.del_flag = '0'
|
||||||
|
) AS cr ON cr.parentId = ch.deptId -- 根据父级进行连接
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT * FROM DeptHierarchy
|
||||||
|
WHERE level <= 3 -- 只选择前 3 级
|
||||||
|
ORDER BY level, deptId; -- 根据级别和部门ID排序
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus</artifactId>
|
<artifactId>bonus</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus-visual</artifactId>
|
<artifactId>bonus-visual</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus</artifactId>
|
<artifactId>bonus</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
4
pom.xml
4
pom.xml
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
<groupId>com.bonus</groupId>
|
<groupId>com.bonus</groupId>
|
||||||
<artifactId>bonus</artifactId>
|
<artifactId>bonus</artifactId>
|
||||||
<version>24.9.0</version>
|
<version>24.10.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>bonus</name>
|
<name>bonus</name>
|
||||||
<url>http://www.ahbonus.cn</url>
|
<url>http://www.ahbonus.cn</url>
|
||||||
<description>博诺思微服务系统</description>
|
<description>博诺思微服务系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<bonus.version>24.9.0</bonus.version>
|
<bonus.version>24.10.0-SNAPSHOT</bonus.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue