Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8774870a
authored
Oct 11, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:用户组织机构返回添加机构名称
1 parent
f679fe44
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
17 deletions
project-interface/src/main/java/com/dituhui/pea/enums/StatusCodeEnum.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-user/src/main/java/com/dituhui/pea/user/utils/LevelUtils.java
project-interface/src/main/java/com/dituhui/pea/enums/StatusCodeEnum.java
View file @
8774870
...
...
@@ -2,6 +2,7 @@ package com.dituhui.pea.enums;
/**
* 错误码枚举类
*
* @author zl
*/
...
...
@@ -38,39 +39,39 @@ public enum StatusCodeEnum {
/**
* 文件不存在
*/
FILE_NOT_EXIST
(
"005"
,
"文件不存在"
,
false
),
FILE_NOT_EXIST
(
"005"
,
"文件不存在"
,
false
),
/**
* 系统异常
*/
SYSTEM_UNKNOWN_ERROR
(
"006"
,
"系统繁忙,请稍后再试...."
,
false
),
SYSTEM_UNKNOWN_ERROR
(
"006"
,
"系统繁忙,请稍后再试...."
,
false
),
REQUEST_LIMIT_ERROR
(
"0429"
,
"请求超限!"
,
false
),
REQUEST_LIMIT_ERROR
(
"0429"
,
"请求超限!"
,
false
),
/**
* 没有查询到对应的数据
*/
NO_DATA
(
"007"
,
"没有查询到对应的数据"
,
false
),
NO_DATA
(
"007"
,
"没有查询到对应的数据"
,
false
),
/**
* 用户不存在
*/
USER_DOES_NOT_EXIST
(
"008"
,
"用户不存在"
,
false
),
USER_DOES_NOT_EXIST
(
"008"
,
"用户不存在"
,
false
),
/**
* 团队不存在
*/
TEAM_DOES_NOT_EXIST
(
"009"
,
"团队不存在"
,
false
),
TEAM_DOES_NOT_EXIST
(
"009"
,
"团队不存在"
,
false
),
/**
* 手机号码已存在
*/
MOBILE_NUMBER_EXISTS
(
"010"
,
"手机号码已存在"
,
false
),
MOBILE_NUMBER_EXISTS
(
"010"
,
"手机号码已存在"
,
false
),
/**
* 账号已存在
*/
ACCOUNT_EXISTS
(
"011"
,
"账号已存在"
,
false
),
ACCOUNT_EXISTS
(
"011"
,
"账号已存在"
,
false
),
/**
* 邮箱已存在
...
...
@@ -80,17 +81,17 @@ public enum StatusCodeEnum {
/**
* 用户已存在团队中,不能重复添加
*/
USER_ALREADY_EXISTS_TEAM
(
"013"
,
"用户已存在团队中,不能重复添加"
,
false
),
USER_ALREADY_EXISTS_TEAM
(
"013"
,
"用户已存在团队中,不能重复添加"
,
false
),
/**
* 角色不存在
*/
ROLE_DOES_NOT_EXIST
(
"014"
,
"角色不存在"
,
false
),
ROLE_DOES_NOT_EXIST
(
"014"
,
"角色不存在"
,
false
),
/**
* 角色资源为空
*/
ROLE_RESOURCE_EMPTY
(
"015"
,
"角色资源为空!"
,
false
),
ROLE_RESOURCE_EMPTY
(
"015"
,
"角色资源为空!"
,
false
),
/**
* 权限资源不存在
...
...
@@ -100,12 +101,12 @@ public enum StatusCodeEnum {
/**
* 角色中已存在该资源,不能重复添加
*/
RESOURCE_ALREADY_EXISTS_ROLE
(
"017"
,
"角色中已存在该资源,不能重复添加"
,
false
),
RESOURCE_ALREADY_EXISTS_ROLE
(
"017"
,
"角色中已存在该资源,不能重复添加"
,
false
),
/**
* 用户状态异常或已被禁用
*/
USER_ISBAN_OR_ERROR
(
"018"
,
"用户状态异常或已被禁用"
,
false
),
USER_ISBAN_OR_ERROR
(
"018"
,
"用户状态异常或已被禁用"
,
false
),
GIS_EXISTS
(
"001"
,
"已存在"
,
false
),
...
...
@@ -121,8 +122,9 @@ public enum StatusCodeEnum {
USER_PHONE_ERROR
(
"019"
,
"手机号格式有误"
,
false
),
USER_EMAIL_ERROR
(
"020"
,
"邮箱格式有误"
,
false
)
;
USER_EMAIL_ERROR
(
"020"
,
"邮箱格式有误"
,
false
),
USER_ORG_NULL_ERROR
(
"021"
,
"组织结构异常或为空"
,
false
);
/**
* 状态码
...
...
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
8774870
...
...
@@ -16,6 +16,7 @@ import com.dituhui.pea.pojo.*;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.user.dao.*
;
import
com.dituhui.pea.user.entity.*
;
import
com.dituhui.pea.user.utils.LevelUtils
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
...
...
@@ -851,9 +852,17 @@ public class UserService {
if
(
CollectionUtils
.
isEmpty
(
byUserId
))
{
return
orgInfos
;
}
byUserId
.
forEach
(
e
->
{
List
<
String
>
collect
=
byUserId
.
stream
().
map
(
UserOrgEntity:
:
getOrgId
).
collect
(
Collectors
.
toList
());
Result
<
List
<
OrganizationDTO
>>
result
=
organizationService
.
getAllOrganizations
(
LevelUtils
.
convertOrgLevel
(
byUserId
.
get
(
0
).
getOrgLevel
()),
collect
);
if
(!
StringUtils
.
equals
(
ResultEnum
.
SUCCESS
.
getCode
(),
result
.
getCode
()))
{
throw
new
BusinessException
(
StatusCodeEnum
.
USER_ORG_NULL_ERROR
);
}
result
.
getResult
().
forEach
(
e
->
{
OrgInfo
orgInfo
=
new
OrgInfo
();
orgInfo
.
setId
(
e
.
getOrgId
());
orgInfo
.
setId
(
e
.
getId
());
orgInfo
.
setName
(
e
.
getName
());
orgInfos
.
add
(
orgInfo
);
});
return
orgInfos
;
...
...
project-user/src/main/java/com/dituhui/pea/user/utils/LevelUtils.java
0 → 100644
View file @
8774870
package
com
.
dituhui
.
pea
.
user
.
utils
;
import
cn.hutool.core.util.ObjectUtil
;
public
class
LevelUtils
{
/**
* 组织级别转换
*
* @param orgLevel
* @return
*/
public
static
String
convertOrgLevel
(
Integer
orgLevel
)
{
if
(
ObjectUtil
.
isNull
(
orgLevel
))
{
return
null
;
}
String
level
=
null
;
switch
(
orgLevel
)
{
case
0
:
return
level
=
"cluster"
;
case
1
:
return
level
=
"branch"
;
case
2
:
return
level
=
"group"
;
}
return
level
;
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment