Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
31fd1b65
Commit
31fd1b65
authored
Nov 17, 2021
by
季圣华
Browse files
新增仓库时给当前用户自动授权
parent
08f2ccdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/service/depot/DepotService.java
View file @
31fd1b65
...
...
@@ -128,6 +128,26 @@ public class DepotService {
depot
.
setType
(
0
);
depot
.
setIsDefault
(
false
);
result
=
depotMapper
.
insertSelective
(
depot
);
//新增仓库时给当前用户自动授权
Long
userId
=
userService
.
getUserId
(
request
);
Long
depotId
=
getIdByName
(
depot
.
getName
());
String
ubKey
=
"["
+
depotId
+
"]"
;
List
<
UserBusiness
>
ubList
=
userBusinessService
.
getBasicData
(
userId
.
toString
(),
"UserDepot"
);
if
(
ubList
==
null
||
ubList
.
size
()
==
0
)
{
JSONObject
ubObj
=
new
JSONObject
();
ubObj
.
put
(
"type"
,
"UserDepot"
);
ubObj
.
put
(
"keyId"
,
userId
);
ubObj
.
put
(
"value"
,
ubKey
);
userBusinessService
.
insertUserBusiness
(
ubObj
,
request
);
}
else
{
UserBusiness
ubInfo
=
ubList
.
get
(
0
);
JSONObject
ubObj
=
new
JSONObject
();
ubObj
.
put
(
"id"
,
ubInfo
.
getId
());
ubObj
.
put
(
"type"
,
ubInfo
.
getType
());
ubObj
.
put
(
"keyId"
,
ubInfo
.
getKeyId
());
ubObj
.
put
(
"value"
,
ubInfo
.
getValue
()
+
ubKey
);
userBusinessService
.
updateUserBusiness
(
ubObj
,
request
);
}
logService
.
insertLog
(
"仓库"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
depot
.
getName
()).
toString
(),
request
);
}
catch
(
Exception
e
){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment