shiro cookie优化,员工授权等其他

This commit is contained in:
易焱
2019-08-05 01:40:30 +08:00
parent 5535ae1ce0
commit 24af3720db
27 changed files with 170 additions and 20 deletions
@@ -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;
@@ -26,6 +26,8 @@ public interface RoleRepository extends BaseRepository<Role,Long> {
*/
List<Role> findAllByStatus(Sort sort, Byte status);
List<Role> findAllByType(Sort sort, String type);
/**
* 查询指定用户的角色列表
* @param id 用户ID
@@ -26,6 +26,14 @@ public interface UserRepository extends BaseRepository<User, Long>, JpaSpecifica
*/
User findByUsernameAndIdNot(String username, Long id);
/**
* 根据手机号码查询用户数据,且排查指定ID的用户
* @param phone 用户手机号码
* @param id 排除的用户ID
* @return 用户数据
*/
User findByPhoneAndIdNot(String phone, Long id);
/**
* 查找多个相应部门的用户列表
*/
@@ -42,6 +42,14 @@ public interface RoleService {
*/
Page<Role> getPageList(Example<Role> example);
/**
* 查询列表
* @param sort
* @param type
* @return
*/
List<Role> getListByType(Sort sort, String type);
/**
* 获取角色列表数据
* @param sort 排序对象
@@ -45,6 +45,13 @@ public interface UserService {
*/
Boolean repeatByUsername(User user);
/**
* 手机号码是否重复
* @param user 用户对象
* @return 用户数据
*/
Boolean repeatByPhone(User user);
/**
* 根据用户ID查询用户数据
* @param id 用户ID
@@ -68,6 +68,11 @@ public class RoleServiceImpl implements RoleService {
return roleRepository.findAll(example, page);
}
@Override
public List<Role> getListByType(Sort sort, String type) {
return roleRepository.findAllByType(sort, type);
}
/**
* 获取角色列表数据
* @param sort 排序对象
@@ -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<User, BssPlatform> join = root.join("bssPlatform", JoinType.INNER);
Predicate eq = cb.equal(join.get("id").as(Long.class),bssPlatform.getId());