|
|
|
@ -65,15 +65,6 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
private SysUserInfoRepository sysUserInfoRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IUserPermissionDao userPermissionDao;
|
|
|
|
|
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private SysOrganizeRepository organizeRDao;
|
|
|
|
|
//
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private SysRoleRepository sysRoleRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysRefUserRoleRepository refUserRoleRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -83,15 +74,6 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
private SysRefUserPositionRepository refUserPositionRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysFileRepository sysFileRDao;
|
|
|
|
|
//
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private SysDepartmentRepository departmentRDao;
|
|
|
|
|
//
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private SysPositionRepository sysPositionRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysUserInfoService sysUserInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -119,42 +101,37 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
private ISysMenuService menuService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICoreMemTreeService memTreeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysFileService fileService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysUserPasswordUtil passwordUtil;
|
|
|
|
|
|
|
|
|
|
@Autowired ISysUserPasswordService userPasswordService;
|
|
|
|
|
|
|
|
|
|
@Resource(name = CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
|
@Autowired
|
|
|
|
|
ISysUserPasswordService userPasswordService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 缓存
|
|
|
|
|
*/
|
|
|
|
|
@Resource(name= CommonConstWords.IMPP_REDIS_SESSION)
|
|
|
|
|
@Resource(name = CommonConstWords.IMPP_REDIS_SESSION)
|
|
|
|
|
private ImppRedis redisSession;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "用户登录", notes = "用户登录功能实现")
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED)
|
|
|
|
|
public SessionUser queryUserLogin(String loginName, String password, String languageCode,Integer loginPlatform,String deviceId) throws AuthenticationException {
|
|
|
|
|
public SessionUser loginUser(String loginName, String password, String languageCode, Integer loginPlatform, String deviceId) throws AuthenticationException {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER loginName:{} \t password:{} \t languageCode:{}", loginName, password, languageCode);
|
|
|
|
|
|
|
|
|
|
BaseToken token = getToken(loginName, password, languageCode, loginPlatform);
|
|
|
|
|
SessionUser sessionUser = AuthUtil.login(token);
|
|
|
|
|
SysUser user = this.getSysUserByLoginName(loginName);
|
|
|
|
|
|
|
|
|
|
if(user == null){
|
|
|
|
|
if (user == null) {
|
|
|
|
|
throw new CredentialsException("用户不存在");
|
|
|
|
|
}
|
|
|
|
|
// 判断会话模式
|
|
|
|
|
checkSessionMode(loginPlatform,user.getId());
|
|
|
|
|
checkSessionMode(loginPlatform, user.getId());
|
|
|
|
|
|
|
|
|
|
packSessionUser(sessionUser, user, user.getUserType(),loginPlatform, languageCode,deviceId);
|
|
|
|
|
packSessionUser(sessionUser, user, user.getUserType(), loginPlatform, languageCode, deviceId);
|
|
|
|
|
packConfigSessionUser(sessionUser, user);
|
|
|
|
|
AuthUtil.setSessionUser(sessionUser);
|
|
|
|
|
refreshUserLoginInformation(user.getId());
|
|
|
|
@ -163,12 +140,12 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
return sessionUser;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkSessionMode(Integer loginPlatform,Long userId){
|
|
|
|
|
int sessionMode = RedisCacheTool.getSysConfigIntVal(CommonConstWords.CONFIG_SESSION_MODE,CommonConstWords.CONFIG_SESSION_MODE_DEFAULT);
|
|
|
|
|
private void checkSessionMode(Integer loginPlatform, Long userId) {
|
|
|
|
|
int sessionMode = RedisCacheTool.getSysConfigIntVal(CommonConstWords.CONFIG_SESSION_MODE, CommonConstWords.CONFIG_SESSION_MODE_DEFAULT);
|
|
|
|
|
String redisKey;
|
|
|
|
|
if (sessionMode == CommonEnumUtil.SESSION_MODE.SEIZE.getValue()) {
|
|
|
|
|
redisKey = CommonConstWords.SESSION_USER + ":*_" + userId;
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -186,15 +163,15 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
@Override
|
|
|
|
|
public BaseToken getToken(String loginName, String password, String languageCode, Integer loginPlatform) {
|
|
|
|
|
SysUser user = this.getSysUserByLoginName(loginName);
|
|
|
|
|
if(user != null){
|
|
|
|
|
if(user.getUserType().equals(CommonEnumUtil.USER_TYPE.ADMIN.getValue())){
|
|
|
|
|
return new AdminToken(loginName,password,languageCode,loginPlatform);
|
|
|
|
|
}else if(user.getUserType().equals(CommonEnumUtil.USER_TYPE.SA.getValue())){
|
|
|
|
|
return new SaAdminToken(loginName,password,languageCode,loginPlatform);
|
|
|
|
|
}else {
|
|
|
|
|
return new UserToken(loginName,password,languageCode,loginPlatform);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if (user != null) {
|
|
|
|
|
if (user.getUserType().equals(CommonEnumUtil.USER_TYPE.ADMIN.getValue())) {
|
|
|
|
|
return new AdminToken(loginName, password, languageCode, loginPlatform);
|
|
|
|
|
} else if (user.getUserType().equals(CommonEnumUtil.USER_TYPE.SA.getValue())) {
|
|
|
|
|
return new SaAdminToken(loginName, password, languageCode, loginPlatform);
|
|
|
|
|
} else {
|
|
|
|
|
return new UserToken(loginName, password, languageCode, loginPlatform);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new CredentialsException("用户不存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -212,7 +189,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
@Override
|
|
|
|
|
public void doLockSysUserById(Long id) {
|
|
|
|
|
SysUser user = userRDao.getById(id);
|
|
|
|
|
if(Objects.nonNull(user)){
|
|
|
|
|
if (Objects.nonNull(user)) {
|
|
|
|
|
user.setUserStatus(CommonEnumUtil.USER_STATUS.LOCKING.getValue());
|
|
|
|
|
userRDao.save(user);
|
|
|
|
|
}
|
|
|
|
@ -221,15 +198,15 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "修改账号", notes = "批量修改账号状态")
|
|
|
|
|
public void updateBatchSysUserStatus(Long[] ids, int status, SessionUser user) {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER DELETE By ids :{} status:{}, SessionUser :{}", ids,status,user);
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER DELETE By ids :{} status:{}, SessionUser :{}", ids, status, user);
|
|
|
|
|
|
|
|
|
|
String where = CoreHqlPack.packHqlIds("id", ids);
|
|
|
|
|
List<SysUser> list = userRDao.findByHqlWhere(where);
|
|
|
|
|
if(null != list && list.size() > 0){
|
|
|
|
|
if (null != list && list.size() > 0) {
|
|
|
|
|
for (SysUser sysUser : list) {
|
|
|
|
|
sysUser.setUserStatus(status);
|
|
|
|
|
sysUser.setIsValid(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
|
ConvertBean.modelUpdate(sysUser,user);
|
|
|
|
|
ConvertBean.modelUpdate(sysUser, user);
|
|
|
|
|
}
|
|
|
|
|
userRDao.saveAll(list);
|
|
|
|
|
}
|
|
|
|
@ -245,9 +222,9 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "修改账号", notes = "修改账号登录密码")
|
|
|
|
|
public void updateSysUserPassword(Long userId, String password, String newPwd) throws Exception {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER Override:{} password:{} newPwd:{}", userId,password,newPwd);
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER Override:{} password:{} newPwd:{}", userId, password, newPwd);
|
|
|
|
|
SysUser user = userRDao.getById(userId);
|
|
|
|
|
ValidatorBean.checkNotNull(user,"用户不存在");
|
|
|
|
|
ValidatorBean.checkNotNull(user, "用户不存在");
|
|
|
|
|
|
|
|
|
|
user.setUserLoginPassword(newPwd);
|
|
|
|
|
passwordUtil.checkPasswordSave(user);
|
|
|
|
@ -294,7 +271,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "新增账号", notes = "新增账号信息")
|
|
|
|
|
public SysUser insertSysUser(SysUser sysUser)throws Exception {
|
|
|
|
|
public SysUser insertSysUser(SysUser sysUser) throws Exception {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER SysUser:{}", sysUser);
|
|
|
|
|
|
|
|
|
|
SysUser loginUser = getSysUserByLoginName(sysUser.getUserLoginName());
|
|
|
|
@ -314,7 +291,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "新增登录日志",notes = "新增登录日志信息")
|
|
|
|
|
@ApiOperation(value = "新增登录日志", notes = "新增登录日志信息")
|
|
|
|
|
public SysLogUserLogin insertSysLogUserLogin(SysLogUserLogin sysLogUserLogin) {
|
|
|
|
|
LOGGER.debug("平台用户登录记录 SysLogUserLogin sysLogUserLogin:{}", sysLogUserLogin);
|
|
|
|
|
return logUserLoginRDao.insert(sysLogUserLogin);
|
|
|
|
@ -332,7 +309,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
// 删除角色关系信息
|
|
|
|
|
refUserRoleRDao.deleteByProperty("userId", sysUser.getId()); // 删除用户角色关系
|
|
|
|
|
|
|
|
|
|
if(null != list && list.size() > 0){
|
|
|
|
|
if (null != list && list.size() > 0) {
|
|
|
|
|
// 新增用户角色关系
|
|
|
|
|
List<SysRefUserRole> refUserRoles = new ArrayList<>();
|
|
|
|
|
List<String> roleNameList = new ArrayList<>();
|
|
|
|
@ -380,19 +357,19 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "删除账号", notes = "批量删除账号信息,逻辑删除,账号关系业务物理删除")
|
|
|
|
|
public void deleteBatchSysUserById(Long[] ids,SessionUser user) {
|
|
|
|
|
public void deleteBatchSysUserById(Long[] ids, SessionUser user) {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER DELETE By ids :{}", ids);
|
|
|
|
|
|
|
|
|
|
// 标记用户已删除
|
|
|
|
|
String where = CoreHqlPack.packHqlIds("id", ids);
|
|
|
|
|
List<SysUser> list = userRDao.findByHqlWhere(where);
|
|
|
|
|
if(null != list && list.size() > 0){
|
|
|
|
|
if (null != list && list.size() > 0) {
|
|
|
|
|
for (SysUser sysUser : list) {
|
|
|
|
|
sysUser.setIsValid(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
userRDao.saveAll(list);
|
|
|
|
|
refUserRoleRDao.deleteByPropertyIn("userId",ids);
|
|
|
|
|
refUserRoleRDao.deleteByPropertyIn("userId", ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -401,7 +378,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
public List<SysUser> list() {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER find All");
|
|
|
|
|
return userRDao.findByProperty(
|
|
|
|
|
new String[]{"isDeleted","isValid"},
|
|
|
|
|
new String[]{"isDeleted", "isValid"},
|
|
|
|
|
new Object[]{
|
|
|
|
|
CommonEnumUtil.IS_DEAL.NO.getValue(),
|
|
|
|
|
CommonEnumUtil.IS_VAILD.VAILD.getValue()
|
|
|
|
@ -417,7 +394,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
public List<SysUser> listByUserOrganizeCode() {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER listByUserOrganizeCode");
|
|
|
|
|
return userRDao.findByProperty(
|
|
|
|
|
new String[]{"isDeleted","isValid","organizeCode"},
|
|
|
|
|
new String[]{"isDeleted", "isValid", "organizeCode"},
|
|
|
|
|
new Object[]{
|
|
|
|
|
CommonEnumUtil.IS_DEAL.NO.getValue(),
|
|
|
|
|
CommonEnumUtil.IS_VAILD.VAILD.getValue(),
|
|
|
|
@ -426,14 +403,14 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询用户ID 集合",notes = "根据角色Id 查询用户ID集合")
|
|
|
|
|
@ApiOperation(value = "查询用户ID 集合", notes = "根据角色Id 查询用户ID集合")
|
|
|
|
|
public List<Long> findSysUserIdListByRoleId(Long roleId) {
|
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
if(roleId != null){
|
|
|
|
|
if (roleId != null) {
|
|
|
|
|
List<SysRefUserRole> list = refUserRoleRDao.findByProperty(
|
|
|
|
|
new String[]{"roleId","isValid"},
|
|
|
|
|
new Object[]{roleId,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
new String[]{"roleId", "isValid"},
|
|
|
|
|
new Object[]{roleId, CommonEnumUtil.IS_VAILD.VAILD.getValue()});
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
for (SysRefUserRole ref : list) {
|
|
|
|
|
result.add(ref.getUserId());
|
|
|
|
|
}
|
|
|
|
@ -443,14 +420,14 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询用户ID 集合",notes = "根据部门Id 查询用户ID集合")
|
|
|
|
|
@ApiOperation(value = "查询用户ID 集合", notes = "根据部门Id 查询用户ID集合")
|
|
|
|
|
public List<Long> findSysUserIdListByDepartmentId(List<Long> idList) {
|
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
if(idList != null && idList.size() > 0){
|
|
|
|
|
if (idList != null && idList.size() > 0) {
|
|
|
|
|
StringBuffer hqlWhere = new StringBuffer();
|
|
|
|
|
HqlPack.getInPack(StringUtils.join(idList, ","), "departmentId", hqlWhere);
|
|
|
|
|
List<SysRefUserDepartment> list = refUserDepartmentRDao.findByHqlWhere(hqlWhere.toString());
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
for (SysRefUserDepartment ref : list) {
|
|
|
|
|
result.add(ref.getUserId());
|
|
|
|
|
}
|
|
|
|
@ -465,20 +442,20 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
LOGGER.debug("系统用户 SysUser find user :{} page :{}", user, pager);
|
|
|
|
|
|
|
|
|
|
// 角色查询
|
|
|
|
|
if(user.getRoleId() != null){
|
|
|
|
|
if (user.getRoleId() != null) {
|
|
|
|
|
List<Long> ids = findSysUserIdListByRoleId(user.getRoleId());
|
|
|
|
|
user.setRoleIdList(StringTool.getListString(ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Long> departmentIdList = new ArrayList<>();
|
|
|
|
|
if(user.getOrganizeId() != null){
|
|
|
|
|
if (user.getOrganizeId() != null) {
|
|
|
|
|
|
|
|
|
|
// 查出所有组织 ID 集合
|
|
|
|
|
SysOrganize parent = coreTreeService.getSysOrganizeTreeById(user.getOrganizeId());
|
|
|
|
|
List<Long> childIds = coreTreeService.findSysOrganizeChildIds(parent);
|
|
|
|
|
|
|
|
|
|
// 查询所有部门 ID 集合
|
|
|
|
|
if(childIds != null && childIds.size() > 0){
|
|
|
|
|
if (childIds != null && childIds.size() > 0) {
|
|
|
|
|
for (Long organizeId : childIds) {
|
|
|
|
|
List<Long> ids = coreTreeService.findSysDepartmentIdByOrganizeId(organizeId);
|
|
|
|
|
departmentIdList.addAll(ids);
|
|
|
|
@ -487,7 +464,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 封装部门 ID 信息
|
|
|
|
|
if(user.getDepartmentId() != null){
|
|
|
|
|
if (user.getDepartmentId() != null) {
|
|
|
|
|
SysDepartment department = departmentService.get(user.getDepartmentId());
|
|
|
|
|
departmentIdList.addAll(coreTreeService.findSysDepartmentChildIds(department));
|
|
|
|
|
}
|
|
|
|
@ -518,7 +495,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "用户查询", notes = "根据ID 查询用户信息")
|
|
|
|
|
public SysUserInfo getSysUserInfoById(Long id) {
|
|
|
|
|
return sysUserInfoRDao.getByProperty("id",id);
|
|
|
|
|
return sysUserInfoRDao.getByProperty("id", id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -547,63 +524,63 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "账号角色", notes = "根据账号ID查询账号角色关系")
|
|
|
|
|
public List<SysRefUserRole> findSysRefUserRoleByUserId(Long userId) {
|
|
|
|
|
return refUserRoleRDao.findByProperty("userId",userId);
|
|
|
|
|
return refUserRoleRDao.findByProperty("userId", userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "检查-账号登录名", notes = "判断账号是否存在")
|
|
|
|
|
public boolean checkSysUserLoginName(String userLoginName, long id) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
if(id > 0){
|
|
|
|
|
if (id > 0) {
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getStringEqualPack(userLoginName,"userLoginName",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(id,"id",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(userLoginName, "userLoginName", sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(id, "id", sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount("userLoginName",userLoginName);
|
|
|
|
|
} else {
|
|
|
|
|
count = userRDao.findByPropertyCount("userLoginName", userLoginName);
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
return count <= 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "检查-账号邮箱", notes = "判断邮箱是否存在")
|
|
|
|
|
public boolean checkSysUserEmail(String email, long id) {
|
|
|
|
|
int count;
|
|
|
|
|
if(id > 0){
|
|
|
|
|
if (id > 0) {
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getStringEqualPack(email,"userEmail",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(id,"id",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(email, "userEmail", sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(id, "id", sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount("userEmail",email);
|
|
|
|
|
} else {
|
|
|
|
|
count = userRDao.findByPropertyCount("userEmail", email);
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
return count <= 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "检查-账号手机", notes = "判断手机是否存在")
|
|
|
|
|
public boolean checkSysUserPhone(String phone, long id) {
|
|
|
|
|
int count;
|
|
|
|
|
if(id > 0){
|
|
|
|
|
if (id > 0) {
|
|
|
|
|
StringBuffer sw = new StringBuffer();
|
|
|
|
|
HqlPack.getStringEqualPack(phone,"userPhone",sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(id,"id",sw);
|
|
|
|
|
HqlPack.getStringEqualPack(phone, "userPhone", sw);
|
|
|
|
|
HqlPack.getNumNOEqualPack(id, "id", sw);
|
|
|
|
|
count = userRDao.findByHqlWhereCount(sw.toString());
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
count = userRDao.findByPropertyCount("userPhone",phone);
|
|
|
|
|
} else {
|
|
|
|
|
count = userRDao.findByPropertyCount("userPhone", phone);
|
|
|
|
|
}
|
|
|
|
|
return count <= 0 ;
|
|
|
|
|
return count <= 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "检查-账号唯一", notes = "账号唯一性校验")
|
|
|
|
|
public void checkSysUserOnly(SysUser user) {
|
|
|
|
|
if(user != null){
|
|
|
|
|
if (user != null) {
|
|
|
|
|
// 登录名唯一教研
|
|
|
|
|
if(!checkSysUserLoginName(user.getUserLoginName(), user.getId() == null ? 0 : user.getId())){
|
|
|
|
|
if (!checkSysUserLoginName(user.getUserLoginName(), user.getId() == null ? 0 : user.getId())) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -613,7 +590,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 登录名唯一教研
|
|
|
|
|
if(!checkSysUserEmail(user.getUserEmail(),user.getId() == null ? 0 : user.getId())){
|
|
|
|
|
if (!checkSysUserEmail(user.getUserEmail(), user.getId() == null ? 0 : user.getId())) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -623,7 +600,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 登录名唯一教研
|
|
|
|
|
if(!checkSysUserPhone(user.getUserPhone(),user.getId() == null ? 0 : user.getId())){
|
|
|
|
|
if (!checkSysUserPhone(user.getUserPhone(), user.getId() == null ? 0 : user.getId())) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -650,12 +627,12 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "封装用户信息",notes = "封装登录完成后的用户信息(角色、权限、部门、组织、岗位)")
|
|
|
|
|
public SessionUser packSessionUser(SessionUser sessionUser, SysUser user,Integer userType,Integer loginPlatform, String languageCode, String deviceId) {
|
|
|
|
|
@ApiOperation(value = "封装用户信息", notes = "封装登录完成后的用户信息(角色、权限、部门、组织、岗位)")
|
|
|
|
|
public SessionUser packSessionUser(SessionUser sessionUser, SysUser user, Integer userType, Integer loginPlatform, String languageCode, String deviceId) {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getId());
|
|
|
|
|
SysUserInfo userInfo = sysUserInfoRDao.getById(user.getUserInfoId());
|
|
|
|
|
|
|
|
|
|
if(userInfo == null){
|
|
|
|
|
if (userInfo == null) {
|
|
|
|
|
throw new UnknownAccountException("用户信息不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -692,27 +669,27 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
public SessionUser packPageSessionUser(SessionUser sessionUser, SysUser user) {
|
|
|
|
|
SysConfig configPageList = RedisCacheTool.getSysConfigByConfigCode(CommonConstWords.CONFIG_PAGE_SIZE_LIST);
|
|
|
|
|
try {
|
|
|
|
|
if(configPageList != null && StringUtils.isNotBlank(configPageList.getConfigValue())){
|
|
|
|
|
if (configPageList != null && StringUtils.isNotBlank(configPageList.getConfigValue())) {
|
|
|
|
|
String[] split = configPageList.getConfigValue().split(",");
|
|
|
|
|
int[] ints = Arrays.stream(split).mapToInt(Integer::parseInt).toArray();
|
|
|
|
|
sessionUser.setPageSizeArray(Arrays.stream(ints).boxed().toArray(Integer[]::new));
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sessionUser.getPageSizeArray() == null){
|
|
|
|
|
if (sessionUser.getPageSizeArray() == null) {
|
|
|
|
|
sessionUser.setPageSizeArray(CommonConstWords.CONFIG_PAGE_SIZE_LIST_DEFAULT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SysConfig configPageSize = RedisCacheTool.getSysConfigByConfigCode(CommonConstWords.CONFIG_PAGE_DEFAULT_SIZE);
|
|
|
|
|
try {
|
|
|
|
|
if(configPageSize != null && StringUtils.isNotBlank(configPageSize.getConfigValue())){
|
|
|
|
|
if (configPageSize != null && StringUtils.isNotBlank(configPageSize.getConfigValue())) {
|
|
|
|
|
sessionUser.setPageDefaultSize(Integer.parseInt(configPageSize.getConfigValue()));
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception ignored){
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sessionUser.getPageDefaultSize() == null || sessionUser.getPageDefaultSize() <= 0){
|
|
|
|
|
if (sessionUser.getPageDefaultSize() == null || sessionUser.getPageDefaultSize() <= 0) {
|
|
|
|
|
sessionUser.setPageDefaultSize(CommonConstWords.CONFIG_PAGE_DEFAULT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -741,25 +718,26 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
* 序号倒叙 + 编号升序 菜单
|
|
|
|
|
* 创建时间 组织升序
|
|
|
|
|
* 创建时间 部门升序
|
|
|
|
|
*
|
|
|
|
|
* @param user
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserSort(SysUser user){
|
|
|
|
|
if(user != null){
|
|
|
|
|
public void packSysUserSort(SysUser user) {
|
|
|
|
|
if (user != null) {
|
|
|
|
|
// 创建时间升序
|
|
|
|
|
if(user.getRoleList() != null){
|
|
|
|
|
if (user.getRoleList() != null) {
|
|
|
|
|
user.getRoleList().sort(Comparator.comparing(SysRole::getCreateDatetime));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(user.getMenuList() != null){
|
|
|
|
|
if (user.getMenuList() != null) {
|
|
|
|
|
user.getMenuList().sort(Comparator.comparing(SysMenu::getMenuSort).reversed() // 倒序
|
|
|
|
|
.thenComparing(SysMenu::getMenuCode)); //升序
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(user.getOrganizeList() != null){
|
|
|
|
|
if (user.getOrganizeList() != null) {
|
|
|
|
|
user.getOrganizeList().sort(Comparator.comparing(SysOrganize::getCreateDatetime));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(user.getDepartmentList() != null){
|
|
|
|
|
if (user.getDepartmentList() != null) {
|
|
|
|
|
user.getDepartmentList().sort(Comparator.comparing(SysDepartment::getCreateDatetime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -770,17 +748,18 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
* 岗位创建时间 升序
|
|
|
|
|
* 部门创建时间 升序
|
|
|
|
|
* 组织创建时间 升序
|
|
|
|
|
*
|
|
|
|
|
* @param info
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserInfoSort(SysUserInfo info){
|
|
|
|
|
if(info != null){
|
|
|
|
|
if(info.getPositionList() != null){
|
|
|
|
|
public void packSysUserInfoSort(SysUserInfo info) {
|
|
|
|
|
if (info != null) {
|
|
|
|
|
if (info.getPositionList() != null) {
|
|
|
|
|
info.getPositionList().sort(Comparator.comparing(SysPosition::getCreateDatetime));
|
|
|
|
|
}
|
|
|
|
|
if(info.getDepartmentList() != null){
|
|
|
|
|
if (info.getDepartmentList() != null) {
|
|
|
|
|
info.getDepartmentList().sort(Comparator.comparing(SysDepartment::getCreateDatetime));
|
|
|
|
|
}
|
|
|
|
|
if(info.getOrganizeList() != null){
|
|
|
|
|
if (info.getOrganizeList() != null) {
|
|
|
|
|
info.getOrganizeList().sort(Comparator.comparing(SysOrganize::getCreateDatetime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -788,15 +767,16 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户角色信息
|
|
|
|
|
*
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserRole(SysUser user){
|
|
|
|
|
public void packSysUserRole(SysUser user) {
|
|
|
|
|
SysRefUserRole refUserRole = new SysRefUserRole();
|
|
|
|
|
refUserRole.setUserId(user.getId());
|
|
|
|
|
List<SysRefUserRole> refUserRoleList = refUserRoleRDao.findByHqlWhere(CoreHqlPack.packDdlBeanSysRefUserRole(refUserRole));
|
|
|
|
|
|
|
|
|
|
if(Objects.nonNull(refUserRoleList)){
|
|
|
|
|
if (Objects.nonNull(refUserRoleList)) {
|
|
|
|
|
List<Long> idList = new ArrayList<>();
|
|
|
|
|
refUserRoleList.forEach(ref -> idList.add(ref.getRoleId()));
|
|
|
|
|
user.setRoleList(roleService.findByIdList(idList));
|
|
|
|
@ -805,14 +785,15 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 菜单信息
|
|
|
|
|
*
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserMenu(SysUser user){
|
|
|
|
|
public void packSysUserMenu(SysUser user) {
|
|
|
|
|
List<SysMenu> list = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.info("平台用户 SYS_USER user id :{}", user.getUserInfoId());
|
|
|
|
|
if(user.getRoleList() != null && user.getRoleList().size() > 0){
|
|
|
|
|
if (user.getRoleList() != null && user.getRoleList().size() > 0) {
|
|
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
|
|
Set<Long> menuIdList = new HashSet<>();
|
|
|
|
|
user.getRoleList().forEach(role -> {
|
|
|
|
@ -826,17 +807,17 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
List<SysMenu> menuList = menuService.findByIdList(new ArrayList<>(menuIdList));
|
|
|
|
|
if(CollectionUtils.isNotEmpty(menuList)){
|
|
|
|
|
if (CollectionUtils.isNotEmpty(menuList)) {
|
|
|
|
|
for (SysMenu menu : menuList) {
|
|
|
|
|
if(CommonConstWords.SYSTEM_MENU_ROOT_ID.equals(menu.getParentId())){
|
|
|
|
|
if (CommonConstWords.SYSTEM_MENU_ROOT_ID.equals(menu.getParentId())) {
|
|
|
|
|
menu.getChildList().clear();
|
|
|
|
|
list.add(menu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Menu information Error userId : {} Exception Message : {} " ,user.getUserInfoId(),e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(" SysUser Peck Menu information Error userId : {} Exception Message : {} ", user.getUserInfoId(), e.getMessage());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -872,10 +853,11 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 部门信息封装
|
|
|
|
|
*
|
|
|
|
|
* @param userInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserInfoDepartment(SysUserInfo userInfo){
|
|
|
|
|
public void packSysUserInfoDepartment(SysUserInfo userInfo) {
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", userInfo.getId());
|
|
|
|
|
|
|
|
|
@ -883,130 +865,138 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
userInfo.setDepartment(departmentService.get(userInfo.getDepartmentId()));
|
|
|
|
|
userInfo.setDepartmentList(personnelService.findSysUserInfoDepartmentByInfoId(userInfo.getId()));
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Department information Error userId : {} Exception Message : {} " ,userInfo.getId(),e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(" SysUser Peck Department information Error userId : {} Exception Message : {} ", userInfo.getId(), e.getMessage());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 部门信息封装
|
|
|
|
|
*
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserDepartment(SysUser user){
|
|
|
|
|
public void packSysUserDepartment(SysUser user) {
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getId());
|
|
|
|
|
|
|
|
|
|
user.setDepartment(departmentService.get(user.getDepartmentId()));
|
|
|
|
|
user.setDepartmentList(personnelService.findSysUserDepartmentByInfoId(user.id));
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Department information Error userId : {} Exception Message : {} " ,user.getId(),e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(" SysUser Peck Department information Error userId : {} Exception Message : {} ", user.getId(), e.getMessage());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 岗位信息封装
|
|
|
|
|
*
|
|
|
|
|
* @param userInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserInfoPosition(SysUserInfo userInfo){
|
|
|
|
|
public void packSysUserInfoPosition(SysUserInfo userInfo) {
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", userInfo.getId());
|
|
|
|
|
SysRefUserPosition refUserPosition = new SysRefUserPosition();
|
|
|
|
|
refUserPosition.setUserId(userInfo.getId());
|
|
|
|
|
List<SysRefUserPosition> refUserPositionList = refUserPositionRDao.findByHqlWhere(CoreHqlPack.packHqlSysRefUserPosition(refUserPosition));
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(refUserPositionList)){
|
|
|
|
|
if (CollectionUtils.isNotEmpty(refUserPositionList)) {
|
|
|
|
|
List<Long> idList = new ArrayList<>();
|
|
|
|
|
refUserPositionList.forEach(ref -> idList.add(ref.getPositionId()));
|
|
|
|
|
userInfo.setPositionList(positionService.findByIdList(idList));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
userInfo.setPosition(positionService.get(userInfo.getPositionId()));
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Position information Error userId : {} Exception Message : {} " ,userInfo.getId(),e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(" SysUser Peck Position information Error userId : {} Exception Message : {} ", userInfo.getId(), e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 组织信息封装
|
|
|
|
|
*
|
|
|
|
|
* @param userInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserInfoOrganize(SysUserInfo userInfo){
|
|
|
|
|
public void packSysUserInfoOrganize(SysUserInfo userInfo) {
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", userInfo.getId());
|
|
|
|
|
userInfo.setOrganize(organizeService.get(userInfo.getOrganizeId()));
|
|
|
|
|
userInfo.setOrganizeList(personnelService.findSysUserInfoOrganize(userInfo.getId()));;
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} " ,userInfo.getId(),e.getMessage());
|
|
|
|
|
userInfo.setOrganizeList(personnelService.findSysUserInfoOrganize(userInfo.getId()));
|
|
|
|
|
;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} ", userInfo.getId(), e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 组织信息封装
|
|
|
|
|
*
|
|
|
|
|
* @param userInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserInfoImage(SysUserInfo userInfo){
|
|
|
|
|
public void packSysUserInfoImage(SysUserInfo userInfo) {
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", userInfo.getId());
|
|
|
|
|
if(Objects.nonNull(userInfo.getUserImageId())){
|
|
|
|
|
if (Objects.nonNull(userInfo.getUserImageId())) {
|
|
|
|
|
SysFile file = fileService.getSysFileById(userInfo.getUserImageId());
|
|
|
|
|
if(Objects.nonNull(file)){
|
|
|
|
|
if (Objects.nonNull(file)) {
|
|
|
|
|
userInfo.setImageFileUrl(file.getFilePath());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} " ,userInfo.getId(),e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} ", userInfo.getId(), e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 组织信息封装
|
|
|
|
|
*
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserOrganize(SysUser user){
|
|
|
|
|
public void packSysUserOrganize(SysUser user) {
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getId());
|
|
|
|
|
user.setOrganize(organizeService.get(user.getOrganizeId()));
|
|
|
|
|
user.setOrganizeList(personnelService.findSysUserOrganize(user.getId()));;
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} " ,user.getId(),e.getMessage());
|
|
|
|
|
user.setOrganizeList(personnelService.findSysUserOrganize(user.getId()));
|
|
|
|
|
;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} ", user.getId(), e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取集合中的Root Id
|
|
|
|
|
*
|
|
|
|
|
* @param menus
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<SysMenu> getSysMenuRootIds(List<SysMenu> menus){
|
|
|
|
|
Map<Long,SysMenu> map = new HashMap<>();
|
|
|
|
|
private List<SysMenu> getSysMenuRootIds(List<SysMenu> menus) {
|
|
|
|
|
Map<Long, SysMenu> map = new HashMap<>();
|
|
|
|
|
List<SysMenu> result = new ArrayList<>();
|
|
|
|
|
SysMenu parentMenu = null;
|
|
|
|
|
|
|
|
|
|
// 获取所有顶级节点 ParentId 不存在的对象
|
|
|
|
|
for (SysMenu menu : menus) {
|
|
|
|
|
parentMenu = map.get(menu.getParentId());
|
|
|
|
|
if(parentMenu == null){
|
|
|
|
|
if (parentMenu == null) {
|
|
|
|
|
for (SysMenu sysMenu : menus) {
|
|
|
|
|
if(sysMenu.getId().longValue() == menu.getParentId().longValue()){
|
|
|
|
|
if (sysMenu.getId().longValue() == menu.getParentId().longValue()) {
|
|
|
|
|
parentMenu = sysMenu;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map.put(menu.getParentId(),parentMenu);
|
|
|
|
|
map.put(menu.getParentId(), parentMenu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 封装返回对象
|
|
|
|
|
for (Long parentId : map.keySet()) {
|
|
|
|
|
if(map.get(parentId) == null){
|
|
|
|
|
if (map.get(parentId) == null) {
|
|
|
|
|
for (SysMenu sysMenu : menus) {
|
|
|
|
|
if(sysMenu.getParentId().longValue() == parentId.longValue()){
|
|
|
|
|
if (sysMenu.getParentId().longValue() == parentId.longValue()) {
|
|
|
|
|
result.add(sysMenu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|