From 24af3720db93d23caafd3c42f5a98c0731092e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E7=84=B1?= Date: Mon, 5 Aug 2019 01:40:30 +0800 Subject: [PATCH] =?UTF-8?q?shiro=20cookie=E4=BC=98=E5=8C=96,=E5=91=98?= =?UTF-8?q?=E5=B7=A5=E6=8E=88=E6=9D=83=E7=AD=89=E5=85=B6=E4=BB=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BssDeptController.java | 3 +- .../controller/BssEmployeeController.java | 5 ++- .../controller/BssPlatformController.java | 3 +- .../system/controller/LoginController.java | 1 - .../system/controller/RoleController.java | 35 ++++++++++++++++++ .../system/controller/UserController.java | 5 +++ .../templates/business/employee/index.html | 4 +- admin/src/main/resources/templates/main.html | 2 +- .../resources/templates/system/role/add.html | 6 +++ .../templates/system/role/detail.html | 4 ++ .../cwhelp/common/constant/AdminConst.java | 10 +++-- .../com/cwhelp/common/constant/RoleConst.java | 19 ++++++++++ .../com/cwhelp/common/enums/ResultEnum.java | 2 + .../exception/advice/ExceptionAdvice.java | 2 +- .../exception/interfaces/ResultInterface.java | 4 +- .../com/cwhelp/component/shiro/AuthRealm.java | 6 ++- .../component/shiro/ICSecurityUtils.java | 11 ++++++ .../com/cwhelp/component/shiro/ShiroUtil.java | 14 ++++++- .../component/shiro/config/AuditorConfig.java | 9 ++++- .../cwhelp/modules/system/domain/Role.java | 1 + .../system/repository/RoleRepository.java | 2 + .../system/repository/UserRepository.java | 8 ++++ .../modules/system/service/RoleService.java | 8 ++++ .../modules/system/service/UserService.java | 7 ++++ .../system/service/impl/RoleServiceImpl.java | 5 +++ .../system/service/impl/UserServiceImpl.java | 14 ++++++- sdoc/设计.docx | Bin 14157 -> 14169 bytes 27 files changed, 170 insertions(+), 20 deletions(-) create mode 100644 common/src/main/java/com/cwhelp/common/constant/RoleConst.java create mode 100644 component/shiro/src/main/java/com/cwhelp/component/shiro/ICSecurityUtils.java diff --git a/admin/src/main/java/com/cwhelp/admin/business/controller/BssDeptController.java b/admin/src/main/java/com/cwhelp/admin/business/controller/BssDeptController.java index 9063137..5555db3 100644 --- a/admin/src/main/java/com/cwhelp/admin/business/controller/BssDeptController.java +++ b/admin/src/main/java/com/cwhelp/admin/business/controller/BssDeptController.java @@ -1,6 +1,7 @@ package com.cwhelp.admin.business.controller; import com.cwhelp.admin.business.validator.BssDeptValid; +import com.cwhelp.common.constant.AdminConst; import com.cwhelp.common.enums.StatusEnum; import com.cwhelp.common.utils.EntityBeanUtil; import com.cwhelp.common.utils.ResultVoUtil; @@ -51,7 +52,7 @@ public class BssDeptController { .withMatcher("name", match -> match.contains()); User user = ShiroUtil.getSubject(); - if (1 != user.getBssPlatform().getId()) { + if (AdminConst.ADMIN_PLATFORM_ID != user.getBssPlatform().getId()) { matcher.withMatcher("bssPlatform.id",match -> match.contains()); BssPlatform bssPlatform = new BssPlatform(); bssPlatform.setId(user.getBssPlatform().getId()); diff --git a/admin/src/main/java/com/cwhelp/admin/business/controller/BssEmployeeController.java b/admin/src/main/java/com/cwhelp/admin/business/controller/BssEmployeeController.java index 78586ce..48c4982 100644 --- a/admin/src/main/java/com/cwhelp/admin/business/controller/BssEmployeeController.java +++ b/admin/src/main/java/com/cwhelp/admin/business/controller/BssEmployeeController.java @@ -2,6 +2,7 @@ package com.cwhelp.admin.business.controller; import com.cwhelp.admin.business.validator.BssEmployeeValid; +import com.cwhelp.common.constant.AdminConst; import com.cwhelp.common.enums.StatusEnum; import com.cwhelp.common.utils.EntityBeanUtil; import com.cwhelp.common.utils.ResultVoUtil; @@ -53,7 +54,7 @@ public class BssEmployeeController { User user = ShiroUtil.getSubject(); List bssDepts = null; - if (1 != user.getBssPlatform().getId()) { + if (AdminConst.ADMIN_PLATFORM_ID != user.getBssPlatform().getId()) { bssDepts = bssDeptService.findBssDeptByBssPlatformAndId(user.getBssPlatform()); } Page list = bssEmployeeService.getPageList(bssDepts,bssEmployee); @@ -99,7 +100,7 @@ public class BssEmployeeController { */ private List getBssDepts(User user, BssPlatform bssPlatform) { List bssDepts = null; - if (1 != user.getBssPlatform().getId()) { + if (AdminConst.ADMIN_PLATFORM_ID != user.getBssPlatform().getId()) { bssDepts = bssDeptService.findBssDeptByBssPlatformAndId(bssPlatform); } else { bssDepts = bssDeptService.findAll(); diff --git a/admin/src/main/java/com/cwhelp/admin/business/controller/BssPlatformController.java b/admin/src/main/java/com/cwhelp/admin/business/controller/BssPlatformController.java index 2061584..cde7421 100644 --- a/admin/src/main/java/com/cwhelp/admin/business/controller/BssPlatformController.java +++ b/admin/src/main/java/com/cwhelp/admin/business/controller/BssPlatformController.java @@ -1,6 +1,7 @@ package com.cwhelp.admin.business.controller; import com.cwhelp.admin.business.validator.BssPlatformValid; +import com.cwhelp.common.constant.AdminConst; import com.cwhelp.common.enums.ResultEnum; import com.cwhelp.common.enums.StatusEnum; import com.cwhelp.common.utils.EntityBeanUtil; @@ -52,7 +53,7 @@ public class BssPlatformController { .withMatcher("email", match -> match.contains()); User user = ShiroUtil.getSubject(); // 判定当前用户的 所属平台 1为系统平台 - if (1 != user.getBssPlatform().getId()) { + if (AdminConst.ADMIN_PLATFORM_ID != user.getBssPlatform().getId()) { matcher.withMatcher("id",match -> match.contains()); bssPlatform.setId(user.getBssPlatform().getId()); } diff --git a/admin/src/main/java/com/cwhelp/admin/system/controller/LoginController.java b/admin/src/main/java/com/cwhelp/admin/system/controller/LoginController.java index c3d517d..1380811 100644 --- a/admin/src/main/java/com/cwhelp/admin/system/controller/LoginController.java +++ b/admin/src/main/java/com/cwhelp/admin/system/controller/LoginController.java @@ -79,7 +79,6 @@ public class LoginController implements ErrorController { // 1.获取Subject主体对象 Subject subject = SecurityUtils.getSubject(); - // 2.封装用户数据 UsernamePasswordToken token = new UsernamePasswordToken(username, password); diff --git a/admin/src/main/java/com/cwhelp/admin/system/controller/RoleController.java b/admin/src/main/java/com/cwhelp/admin/system/controller/RoleController.java index 31f243c..f315724 100644 --- a/admin/src/main/java/com/cwhelp/admin/system/controller/RoleController.java +++ b/admin/src/main/java/com/cwhelp/admin/system/controller/RoleController.java @@ -2,6 +2,7 @@ package com.cwhelp.admin.system.controller; import com.cwhelp.admin.system.validator.RoleValid; import com.cwhelp.common.constant.AdminConst; +import com.cwhelp.common.constant.RoleConst; import com.cwhelp.common.enums.ResultEnum; import com.cwhelp.common.enums.StatusEnum; import com.cwhelp.common.exception.ResultException; @@ -14,17 +15,22 @@ import com.cwhelp.component.actionLog.action.StatusAction; import com.cwhelp.component.actionLog.annotation.ActionLog; import com.cwhelp.component.actionLog.annotation.EntityParam; import com.cwhelp.component.shiro.ShiroUtil; +import com.cwhelp.modules.business.domain.BssEmployee; import com.cwhelp.modules.system.domain.Menu; import com.cwhelp.modules.system.domain.Role; +import com.cwhelp.modules.system.domain.User; import com.cwhelp.modules.system.service.MenuService; import com.cwhelp.modules.system.service.RoleService; +import com.cwhelp.modules.system.service.UserService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Example; import org.springframework.data.domain.ExampleMatcher; import org.springframework.data.domain.Page; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -45,6 +51,8 @@ public class RoleController { @Autowired private MenuService menuService; + @Autowired + private UserService userService; /** * 列表页面 */ @@ -66,6 +74,33 @@ public class RoleController { return "/system/role/index"; } + /** + * 跳转到角色分配页面 + */ + @GetMapping("/rolePage") + @RequiresPermissions("system:user:role") + public String toRole(@RequestParam(value = "ids") BssEmployee bssEmployee, Model model) { + User user = userService.getByName(bssEmployee.getPhoneNum()); + if (ObjectUtils.isEmpty(user)) { + throw new ResultException(ResultEnum.USER_NOE_EXIST); + } + // 获取指定用户角色列表 + Set authRoles = user.getRoles(); + Sort sort = new Sort(Sort.Direction.ASC, "createDate"); + List list = null; + //如果当前用户是超级用户 + if (user.getId() == AdminConst.ADMIN_ID) { + list = roleService.getListBySortOk(sort); + } else { + list = roleService.getListByType(sort, RoleConst.ROLE_ORDINARY_TYPE); + } + + model.addAttribute("id", user.getId()); + model.addAttribute("list", list); + model.addAttribute("authRoles", authRoles); + return "/system/user/role"; + } + /** * 跳转到添加页面 */ diff --git a/admin/src/main/java/com/cwhelp/admin/system/controller/UserController.java b/admin/src/main/java/com/cwhelp/admin/system/controller/UserController.java index 6a14ebc..ccd2588 100644 --- a/admin/src/main/java/com/cwhelp/admin/system/controller/UserController.java +++ b/admin/src/main/java/com/cwhelp/admin/system/controller/UserController.java @@ -155,6 +155,11 @@ public class UserController { throw new ResultException(ResultEnum.USER_EXIST); } + // 判断手机号码是否重复 + if (userService.repeatByPhone(user)) { + throw new ResultException(ResultEnum.USER_PHONE_EXIST); + } + // 复制保留无需修改的数据 if (user.getId() != null) { // 不允许操作超级管理员数据 diff --git a/admin/src/main/resources/templates/business/employee/index.html b/admin/src/main/resources/templates/business/employee/index.html index 2aa5ae0..f191999 100644 --- a/admin/src/main/resources/templates/business/employee/index.html +++ b/admin/src/main/resources/templates/business/employee/index.html @@ -38,13 +38,14 @@
+
@@ -88,7 +89,6 @@ 编辑 详细 删除 - 授权 diff --git a/admin/src/main/resources/templates/main.html b/admin/src/main/resources/templates/main.html index e6e1017..8f40104 100644 --- a/admin/src/main/resources/templates/main.html +++ b/admin/src/main/resources/templates/main.html @@ -54,7 +54,7 @@ 头像
-

TIMO

+

在线

diff --git a/admin/src/main/resources/templates/system/role/add.html b/admin/src/main/resources/templates/system/role/add.html index 158c81b..4dfab7e 100644 --- a/admin/src/main/resources/templates/system/role/add.html +++ b/admin/src/main/resources/templates/system/role/add.html @@ -18,6 +18,12 @@ +
+ +
+ +
+
diff --git a/admin/src/main/resources/templates/system/role/detail.html b/admin/src/main/resources/templates/system/role/detail.html index 55408ab..bdc9464 100644 --- a/admin/src/main/resources/templates/system/role/detail.html +++ b/admin/src/main/resources/templates/system/role/detail.html @@ -13,6 +13,10 @@ 角色编号名称 [[${role.title}]]([[${role.name}]]) + + 角色类型 + + 创建用户 diff --git a/common/src/main/java/com/cwhelp/common/constant/AdminConst.java b/common/src/main/java/com/cwhelp/common/constant/AdminConst.java index e9817e9..25d111d 100644 --- a/common/src/main/java/com/cwhelp/common/constant/AdminConst.java +++ b/common/src/main/java/com/cwhelp/common/constant/AdminConst.java @@ -9,21 +9,23 @@ public class AdminConst { /** * 超级管理员id */ - public static Long ADMIN_ID = 1L; + public static final Long ADMIN_ID = 1L; /** * 超级管理员用户名 */ - public static String ADMIN_NAME = "admin"; + public static final String ADMIN_NAME = "admin"; /** * 超级管理员角色id */ - public static Long ADMIN_ROLE_ID = 1L; + public static final Long ADMIN_ROLE_ID = 1L; /** * 超级管理员角色标识名称 */ - public static String ADMIN_ROLE_NAME = "admin"; + public static final String ADMIN_ROLE_NAME = "admin"; + + public static final Long ADMIN_PLATFORM_ID = 1L; } diff --git a/common/src/main/java/com/cwhelp/common/constant/RoleConst.java b/common/src/main/java/com/cwhelp/common/constant/RoleConst.java new file mode 100644 index 0000000..3fcef80 --- /dev/null +++ b/common/src/main/java/com/cwhelp/common/constant/RoleConst.java @@ -0,0 +1,19 @@ +package com.cwhelp.common.constant; + +/** + * @author: yan.y + * @Description: + * @Date: Created in 1:12 2019/8/5 + */ +public class RoleConst { + + /** + * 角色平台类型 + */ + public static final String ROLE_PLATFORM_TYPE = "1"; + + /** + * 角色普通类型 + */ + public static final String ROLE_ORDINARY_TYPE = "2"; +} diff --git a/common/src/main/java/com/cwhelp/common/enums/ResultEnum.java b/common/src/main/java/com/cwhelp/common/enums/ResultEnum.java index a63bbc3..7d4b97d 100644 --- a/common/src/main/java/com/cwhelp/common/enums/ResultEnum.java +++ b/common/src/main/java/com/cwhelp/common/enums/ResultEnum.java @@ -26,6 +26,8 @@ public enum ResultEnum implements ResultInterface { USER_NAME_PWD_NULL(405, "用户名和密码不能为空"), USER_CAPTCHA_ERROR(406, "验证码错误"), USER_PWD_STRENGTH_ERROR(407, "密码强度不够"), + USER_PHONE_EXIST(408, "该用户手机号码已经存在"), + USER_NOE_EXIST(409, "该用户不存在"), /** * 平台 diff --git a/common/src/main/java/com/cwhelp/common/exception/advice/ExceptionAdvice.java b/common/src/main/java/com/cwhelp/common/exception/advice/ExceptionAdvice.java index 07d117b..9da6475 100644 --- a/common/src/main/java/com/cwhelp/common/exception/advice/ExceptionAdvice.java +++ b/common/src/main/java/com/cwhelp/common/exception/advice/ExceptionAdvice.java @@ -5,5 +5,5 @@ package com.cwhelp.common.exception.advice; * @author yan.y */ public interface ExceptionAdvice { - public void run(RuntimeException e); + void run(RuntimeException e); } diff --git a/common/src/main/java/com/cwhelp/common/exception/interfaces/ResultInterface.java b/common/src/main/java/com/cwhelp/common/exception/interfaces/ResultInterface.java index 614e1be..cab7a36 100644 --- a/common/src/main/java/com/cwhelp/common/exception/interfaces/ResultInterface.java +++ b/common/src/main/java/com/cwhelp/common/exception/interfaces/ResultInterface.java @@ -6,8 +6,8 @@ package com.cwhelp.common.exception.interfaces; */ public interface ResultInterface { - public Integer getCode(); + Integer getCode(); - public String getMessage(); + String getMessage(); } diff --git a/component/shiro/src/main/java/com/cwhelp/component/shiro/AuthRealm.java b/component/shiro/src/main/java/com/cwhelp/component/shiro/AuthRealm.java index a7578b1..6e37412 100644 --- a/component/shiro/src/main/java/com/cwhelp/component/shiro/AuthRealm.java +++ b/component/shiro/src/main/java/com/cwhelp/component/shiro/AuthRealm.java @@ -36,8 +36,10 @@ public class AuthRealm extends AuthorizingRealm { @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principal) { SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); + + Long userId = (Long) principal.getPrimaryPrincipal(); // 获取用户Principal对象 - User user = (User) principal.getPrimaryPrincipal(); + User user = userService.getById(userId); // 管理员拥有所有权限 if(user.getId().equals(AdminConst.ADMIN_ID)){ @@ -85,7 +87,7 @@ public class AuthRealm extends AuthorizingRealm { * 参数3:加盐处理 * 参数4:固定写法 */ - return new SimpleAuthenticationInfo(user, user.getPassword(), salt, getName()); + return new SimpleAuthenticationInfo(user.getId(), user.getPassword(), salt, getName()); } /** diff --git a/component/shiro/src/main/java/com/cwhelp/component/shiro/ICSecurityUtils.java b/component/shiro/src/main/java/com/cwhelp/component/shiro/ICSecurityUtils.java new file mode 100644 index 0000000..c4f859c --- /dev/null +++ b/component/shiro/src/main/java/com/cwhelp/component/shiro/ICSecurityUtils.java @@ -0,0 +1,11 @@ +package com.cwhelp.component.shiro; + +import org.apache.shiro.SecurityUtils; + +/** + * @author: yan.y + * @Description: + * @Date: Created in 0:28 2019/8/5 + */ +public class ICSecurityUtils extends SecurityUtils { +} diff --git a/component/shiro/src/main/java/com/cwhelp/component/shiro/ShiroUtil.java b/component/shiro/src/main/java/com/cwhelp/component/shiro/ShiroUtil.java index d9adc33..61ef253 100644 --- a/component/shiro/src/main/java/com/cwhelp/component/shiro/ShiroUtil.java +++ b/component/shiro/src/main/java/com/cwhelp/component/shiro/ShiroUtil.java @@ -4,10 +4,13 @@ import com.cwhelp.common.utils.EncryptUtil; import com.cwhelp.common.utils.SpringContextUtil; import com.cwhelp.modules.system.domain.Role; import com.cwhelp.modules.system.domain.User; +import com.cwhelp.modules.system.service.UserService; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.SimpleAuthenticationInfo; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.mgt.RememberMeManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import java.util.Set; @@ -15,8 +18,16 @@ import java.util.Set; * Shiro工具类 * @author yan.y */ +@Component public class ShiroUtil { + private static UserService userService; + + @Autowired + public void setUserService(UserService userService){ + ShiroUtil.userService = userService; + } + /** * 加密算法 */ @@ -49,7 +60,8 @@ public class ShiroUtil { * 获取ShiroUser对象 */ public static User getSubject(){ - return (User) SecurityUtils.getSubject().getPrincipal(); + Long userId = (Long) SecurityUtils.getSubject().getPrincipal(); + return userService.getById(userId); } /** diff --git a/component/shiro/src/main/java/com/cwhelp/component/shiro/config/AuditorConfig.java b/component/shiro/src/main/java/com/cwhelp/component/shiro/config/AuditorConfig.java index 96c6e8e..6a6dcb4 100644 --- a/component/shiro/src/main/java/com/cwhelp/component/shiro/config/AuditorConfig.java +++ b/component/shiro/src/main/java/com/cwhelp/component/shiro/config/AuditorConfig.java @@ -1,8 +1,10 @@ package com.cwhelp.component.shiro.config; import com.cwhelp.modules.system.domain.User; +import com.cwhelp.modules.system.service.UserService; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.data.domain.AuditorAware; @@ -14,10 +16,15 @@ import java.util.Optional; */ @Configuration public class AuditorConfig implements AuditorAware { + + @Autowired + private UserService userService; + @Override public Optional getCurrentAuditor() { Subject subject = SecurityUtils.getSubject(); - User user = (User) subject.getPrincipal(); + Long userId = (Long) subject.getPrincipal(); + User user = userService.getById(userId); return Optional.ofNullable(user); } } diff --git a/modules/system/src/main/java/com/cwhelp/modules/system/domain/Role.java b/modules/system/src/main/java/com/cwhelp/modules/system/domain/Role.java index d47d858..1ecd97a 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/system/domain/Role.java +++ b/modules/system/src/main/java/com/cwhelp/modules/system/domain/Role.java @@ -37,6 +37,7 @@ public class Role implements Serializable { private Long id; private String name; private String title; + private String type; private String remark; @CreatedDate private Date createDate; diff --git a/modules/system/src/main/java/com/cwhelp/modules/system/repository/RoleRepository.java b/modules/system/src/main/java/com/cwhelp/modules/system/repository/RoleRepository.java index 7827020..190c69a 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/system/repository/RoleRepository.java +++ b/modules/system/src/main/java/com/cwhelp/modules/system/repository/RoleRepository.java @@ -26,6 +26,8 @@ public interface RoleRepository extends BaseRepository { */ List findAllByStatus(Sort sort, Byte status); + List findAllByType(Sort sort, String type); + /** * 查询指定用户的角色列表 * @param id 用户ID diff --git a/modules/system/src/main/java/com/cwhelp/modules/system/repository/UserRepository.java b/modules/system/src/main/java/com/cwhelp/modules/system/repository/UserRepository.java index 64d94ce..a38fa15 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/system/repository/UserRepository.java +++ b/modules/system/src/main/java/com/cwhelp/modules/system/repository/UserRepository.java @@ -26,6 +26,14 @@ public interface UserRepository extends BaseRepository, JpaSpecifica */ User findByUsernameAndIdNot(String username, Long id); + /** + * 根据手机号码查询用户数据,且排查指定ID的用户 + * @param phone 用户手机号码 + * @param id 排除的用户ID + * @return 用户数据 + */ + User findByPhoneAndIdNot(String phone, Long id); + /** * 查找多个相应部门的用户列表 */ diff --git a/modules/system/src/main/java/com/cwhelp/modules/system/service/RoleService.java b/modules/system/src/main/java/com/cwhelp/modules/system/service/RoleService.java index a13c450..e61c11e 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/system/service/RoleService.java +++ b/modules/system/src/main/java/com/cwhelp/modules/system/service/RoleService.java @@ -42,6 +42,14 @@ public interface RoleService { */ Page getPageList(Example example); + /** + * 查询列表 + * @param sort + * @param type + * @return + */ + List getListByType(Sort sort, String type); + /** * 获取角色列表数据 * @param sort 排序对象 diff --git a/modules/system/src/main/java/com/cwhelp/modules/system/service/UserService.java b/modules/system/src/main/java/com/cwhelp/modules/system/service/UserService.java index 84f429e..6aecffa 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/system/service/UserService.java +++ b/modules/system/src/main/java/com/cwhelp/modules/system/service/UserService.java @@ -45,6 +45,13 @@ public interface UserService { */ Boolean repeatByUsername(User user); + /** + * 手机号码是否重复 + * @param user 用户对象 + * @return 用户数据 + */ + Boolean repeatByPhone(User user); + /** * 根据用户ID查询用户数据 * @param id 用户ID diff --git a/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/RoleServiceImpl.java b/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/RoleServiceImpl.java index 2d1a104..6e780a2 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/RoleServiceImpl.java +++ b/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/RoleServiceImpl.java @@ -68,6 +68,11 @@ public class RoleServiceImpl implements RoleService { return roleRepository.findAll(example, page); } + @Override + public List getListByType(Sort sort, String type) { + return roleRepository.findAllByType(sort, type); + } + /** * 获取角色列表数据 * @param sort 排序对象 diff --git a/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/UserServiceImpl.java b/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/UserServiceImpl.java index fca61f9..1f673b0 100644 --- a/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/UserServiceImpl.java +++ b/modules/system/src/main/java/com/cwhelp/modules/system/service/impl/UserServiceImpl.java @@ -1,5 +1,6 @@ package com.cwhelp.modules.system.service.impl; +import com.cwhelp.common.constant.AdminConst; import com.cwhelp.common.data.PageSort; import com.cwhelp.common.enums.StatusEnum; import com.cwhelp.modules.business.domain.BssPlatform; @@ -57,6 +58,17 @@ public class UserServiceImpl implements UserService { return userRepository.findByUsernameAndIdNot(user.getUsername(), id) != null; } + /** + * 手机号码是否存在 + * @param user 用户对象 + * @return 用户数据 + */ + @Override + public Boolean repeatByPhone(User user) { + Long id = user.getId() != null ? user.getId() : Long.MIN_VALUE; + return userRepository.findByPhoneAndIdNot(user.getPhone(), id) != null; + } + /** * 根据用户ID获取用户信息 * @param id 用户ID @@ -96,7 +108,7 @@ public class UserServiceImpl implements UserService { preList.add(in); } // 1 为财务帮平台超级账号 - if (1 != user.getBssPlatform().getId()) { + if (AdminConst.ADMIN_PLATFORM_ID != user.getBssPlatform().getId()) { BssPlatform bssPlatform = user.getBssPlatform(); Join join = root.join("bssPlatform", JoinType.INNER); Predicate eq = cb.equal(join.get("id").as(Long.class),bssPlatform.getId()); diff --git a/sdoc/设计.docx b/sdoc/设计.docx index 337913985e8b32bf797f42f1fc0e2dc4ab332543..34a77a0bcc89fd050b1741ca6a9f629e9e603dc0 100644 GIT binary pat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