From 5cf9633b3b9b8662943f1354dcb376bc12dae45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=95=B8=E9=9D=9E?= <13281114856@qq.com> Date: Tue, 7 Jun 2022 13:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/service/impl/UserServiceImpl.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java b/portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java index e5f24501..1b964d8e 100644 --- a/portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java +++ b/portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java @@ -48,7 +48,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity private RoleService roleService; - @Override +/* @Override protected void findAfter(UserEntity entity, PageInfo pageInfo, Context context, List<UserEntity> list) throws AppException { Map<Long, String> roleMap = roleService.find(new RoleQuery()).stream().collect(Collectors.toMap(x -> x.getId(), y -> y.getName())); List<Long> userIdList = list.stream().map(item -> item.getId()).collect(Collectors.toList()); @@ -62,7 +62,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity } }); super.findAfter(entity, pageInfo, context, list); - } + }*/ private void doHandlerUser(UserEntity entity) throws AppException { if (StringUtils.isNotEmpty(entity.getLoginPwd())) { @@ -79,6 +79,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity } else { entity.setUserType(UserType.CUSTOMER.getValue()); } + + + } @Override @@ -92,6 +95,12 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity throw new AppException("浣犳病鏈夋潈闄愭墽琛岃鎿嶄綔"); } this.doHandlerUser(entity); + if(!ObjectUtils.isEmpty(entity.getRoleId())){ + RoleUserQuery roleUserQuery = new RoleUserQuery(); + roleUserQuery.setUserId(entity.getId()); + roleUserQuery.setRoleIdList(Arrays.asList(Long.parseLong(entity.getRoleId()))); + roleUserService.assignRoleToUser(roleUserQuery); + } } @@ -194,4 +203,19 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity } + @Override + protected void saveAfter(UserEntity entity, Context context) throws AppException { + super.saveAfter(entity, context); + if(!ObjectUtils.isEmpty(entity.getRoleId())){ + RoleUserQuery roleUserQuery = new RoleUserQuery(); + roleUserQuery.setUserId(entity.getId()); + roleUserQuery.setRoleIdList(Arrays.asList(Long.parseLong(entity.getRoleId()))); + roleUserService.assignRoleToUser(roleUserQuery); + } + } + + @Override + protected void updateAfter(UserEntity entity, Context context) throws AppException { + super.updateAfter(entity, context); + } } \ No newline at end of file -- 2.24.3