Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
scrm
/
rop-merchant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a2c4fd36
authored
Aug 24, 2021
by
wangnb
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
账户体系角色管理名称重复校验--think.wang
1 parent
6ca21b68
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
src/main/java/cn/com/glsx/merchants/enums/BusinessExceptionEnum.java
src/main/java/cn/com/glsx/merchants/service/MerchantRoleService.java
src/main/java/cn/com/glsx/merchants/enums/BusinessExceptionEnum.java
View file @
a2c4fd3
...
@@ -14,6 +14,7 @@ import java.util.Map;
...
@@ -14,6 +14,7 @@ import java.util.Map;
public
enum
BusinessExceptionEnum
implements
ErrorEnum
{
public
enum
BusinessExceptionEnum
implements
ErrorEnum
{
ACCOUNT_NAME_EXIT
(
"13120001"
,
"该名称已被使用,请修改"
),
ACCOUNT_NAME_EXIT
(
"13120001"
,
"该名称已被使用,请修改"
),
ROLE_NAME_EXIT
(
"13120002"
,
"该名称已被其他角色使用,请修改"
),
;
;
private
String
value
;
private
String
value
;
...
...
src/main/java/cn/com/glsx/merchants/service/MerchantRoleService.java
View file @
a2c4fd3
...
@@ -5,6 +5,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
...
@@ -5,6 +5,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.merchants.convert.ConvertRequest
;
import
cn.com.glsx.merchants.convert.ConvertRequest
;
import
cn.com.glsx.merchants.convert.ConvertResponse
;
import
cn.com.glsx.merchants.convert.ConvertResponse
;
import
cn.com.glsx.merchants.enums.BusinessExceptionEnum
;
import
cn.com.glsx.merchants.enums.CommonStatusEnum
;
import
cn.com.glsx.merchants.enums.CommonStatusEnum
;
import
cn.com.glsx.merchants.model.request.MerchantRoleRequest
;
import
cn.com.glsx.merchants.model.request.MerchantRoleRequest
;
import
cn.com.glsx.merchants.model.request.RoleAccountRelationRequest
;
import
cn.com.glsx.merchants.model.request.RoleAccountRelationRequest
;
...
@@ -185,6 +186,13 @@ public class MerchantRoleService {
...
@@ -185,6 +186,13 @@ public class MerchantRoleService {
*/
*/
@SysLog
(
value
=
"保存角色数据"
,
action
=
OperateType
.
ADD
,
module
=
"角色管理"
)
@SysLog
(
value
=
"保存角色数据"
,
action
=
OperateType
.
ADD
,
module
=
"角色管理"
)
public
Boolean
insert
(
RoleInsertRequest
request
)
{
public
Boolean
insert
(
RoleInsertRequest
request
)
{
RpcResponse
<
List
<
MerchantRoleResponse
>>
rpc
=
roleRemote
.
getListByNameRemote
(
request
.
getRoleName
());
if
(!
rpc
.
isSuccess
()){
throw
new
RpcServiceException
(
rpc
.
getException
().
getErrId
(),
rpc
.
getMessage
());
}
if
(
CollectionUtils
.
isNotEmpty
(
rpc
.
getResult
())){
throw
new
RpcServiceException
(
BusinessExceptionEnum
.
ROLE_NAME_EXIT
);
}
MerchantRoleRequest
roleRequest
=
new
MerchantRoleRequest
();
MerchantRoleRequest
roleRequest
=
new
MerchantRoleRequest
();
dozerMapper
.
map
(
request
,
roleRequest
);
dozerMapper
.
map
(
request
,
roleRequest
);
List
<
RoleAccountTypeRequest
>
requestList
=
JSON
.
parseArray
(
request
.
getRequestList
(),
RoleAccountTypeRequest
.
class
);
List
<
RoleAccountTypeRequest
>
requestList
=
JSON
.
parseArray
(
request
.
getRequestList
(),
RoleAccountTypeRequest
.
class
);
...
@@ -204,6 +212,16 @@ public class MerchantRoleService {
...
@@ -204,6 +212,16 @@ public class MerchantRoleService {
*/
*/
@SysLog
(
value
=
"更新角色数据"
,
action
=
OperateType
.
EDIT
,
module
=
"角色管理"
)
@SysLog
(
value
=
"更新角色数据"
,
action
=
OperateType
.
EDIT
,
module
=
"角色管理"
)
public
Boolean
update
(
RoleUpdateRequest
request
)
{
public
Boolean
update
(
RoleUpdateRequest
request
)
{
RpcResponse
<
List
<
MerchantRoleResponse
>>
rpcRoleList
=
roleRemote
.
getListByNameRemote
(
request
.
getRoleName
());
if
(!
rpcRoleList
.
isSuccess
()){
throw
new
RpcServiceException
(
rpcRoleList
.
getException
().
getErrId
(),
rpcRoleList
.
getMessage
());
}
List
<
MerchantRoleResponse
>
list
=
rpcRoleList
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
if
(
list
.
size
()
>
1
||
!(
list
.
get
(
0
).
getId
().
equals
(
request
.
getId
()))){
throw
new
RpcServiceException
(
BusinessExceptionEnum
.
ROLE_NAME_EXIT
);
}
}
MerchantRoleRequest
roleRequest
=
new
MerchantRoleRequest
();
MerchantRoleRequest
roleRequest
=
new
MerchantRoleRequest
();
dozerMapper
.
map
(
request
,
roleRequest
);
dozerMapper
.
map
(
request
,
roleRequest
);
List
<
RoleAccountTypeRequest
>
requestList
=
JSON
.
parseArray
(
request
.
getRequestList
(),
RoleAccountTypeRequest
.
class
);
List
<
RoleAccountTypeRequest
>
requestList
=
JSON
.
parseArray
(
request
.
getRequestList
(),
RoleAccountTypeRequest
.
class
);
...
...
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