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 a8831e5e
authored
Oct 07, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:事务校验
1 parent
c393a76a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
project-interface/src/main/java/com/dituhui/pea/util/UUIDUtil.java
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
project-interface/src/main/java/com/dituhui/pea/util/UUIDUtil.java
0 → 100644
View file @
a8831e5
package
com
.
dituhui
.
pea
.
util
;
import
java.util.UUID
;
/**
* uuid生成工具
* @author guoping
*
*/
public
class
UUIDUtil
{
public
static
String
getUuid
()
{
UUID
uuid
=
UUID
.
randomUUID
();
String
sud
=
uuid
.
toString
();
sud
=
sud
.
replaceAll
(
"-"
,
""
);
return
sud
;
}
public
static
String
getUid
(){
return
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toLowerCase
();
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
getUuid
());
}
}
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
View file @
a8831e5
...
@@ -15,7 +15,9 @@ import com.dituhui.pea.pojo.role.RoleResourceInfo;
...
@@ -15,7 +15,9 @@ import com.dituhui.pea.pojo.role.RoleResourceInfo;
import
com.dituhui.pea.user.commom.RedisService
;
import
com.dituhui.pea.user.commom.RedisService
;
import
com.dituhui.pea.user.dao.*
;
import
com.dituhui.pea.user.dao.*
;
import
com.dituhui.pea.user.entity.*
;
import
com.dituhui.pea.user.entity.*
;
import
com.dituhui.pea.util.UUIDUtil
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -27,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -27,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -36,6 +39,7 @@ import java.util.stream.Collectors;
...
@@ -36,6 +39,7 @@ import java.util.stream.Collectors;
* @author zl
* @author zl
*/
*/
@Service
@Service
@Slf4j
public
class
RoleService
{
public
class
RoleService
{
@Autowired
@Autowired
...
@@ -64,8 +68,21 @@ public class RoleService {
...
@@ -64,8 +68,21 @@ public class RoleService {
@Transactional
@Transactional
public
RoleInfo
addRole
(
RoleInfo
roleInfo
)
{
public
RoleInfo
addRole
(
RoleInfo
roleInfo
)
{
RoleEntity
roleEntity
=
BeanUtil
.
copyProperties
(
roleInfo
,
RoleEntity
.
class
);
log
.
info
(
"新增角色入参:"
+
JSONObject
.
toJSONString
(
roleInfo
));
RoleEntity
roleEntity
=
new
RoleEntity
();
roleEntity
.
setName
(
"123"
);
roleEntity
.
setId
(
UUIDUtil
.
getUuid
());
roleEntity
.
setCreatedBy
(
"212121"
);
roleEntity
.
setUpdatedBy
(
"212121"
);
roleEntity
.
setCreatedTime
(
new
Date
());
roleEntity
.
setUpdatedTime
(
new
Date
());
roleEntity
.
setGroupId
(
"1q2hk"
);
roleEntity
.
setNotes
(
"1q2hk"
);
roleEntity
.
setExtra
(
"1q2hk"
);
// RoleEntity roleEntity = BeanUtil.copyProperties(roleInfo, RoleEntity.class);
roleEntity
=
roleDao
.
save
(
roleEntity
);
roleEntity
=
roleDao
.
save
(
roleEntity
);
log
.
info
(
"新增角色信息:"
+
JSONObject
.
toJSONString
(
roleEntity
));
// // List<RoleResourceInfo> resourceInfos = roleInfo.getResourceInfos();
// // List<RoleResourceInfo> resourceInfos = roleInfo.getResourceInfos();
// // if (CollectionUtils.isNotEmpty(resourceInfos)) {
// // if (CollectionUtils.isNotEmpty(resourceInfos)) {
// // for (RoleResourceInfo resourceInfo : resourceInfos) {
// // for (RoleResourceInfo resourceInfo : resourceInfos) {
...
@@ -73,7 +90,7 @@ public class RoleService {
...
@@ -73,7 +90,7 @@ public class RoleService {
// // roleResourceDao.save(roleResourceEntity);
// // roleResourceDao.save(roleResourceEntity);
// // }
// // }
// // }
// // }
roleInfo
=
BeanUtil
.
copyProperties
(
roleEntity
,
RoleInfo
.
class
);
//
roleInfo = BeanUtil.copyProperties(roleEntity, RoleInfo.class);
return
roleInfo
;
return
roleInfo
;
}
}
...
...
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