Java tutorial
/* * Project: admin-parent * * File Created at 2014-04-16 * * Copyright 2012 Greenline.com Corporation Limited. * All rights reserved. * * This software is the confidential and proprietary information of * Greenline Company. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Greenline.com. */ package com.greenline.hrs.admin.user.service; import com.greenline.hrs.admin.user.biz.*; import com.greenline.hrs.admin.user.po.UserPassport; import com.greenline.hrs.admin.user.vo.UserAuthInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Set; /** * @author July * @version V1.0 * @type ManUserBiz * @desc * @date 2014-04-16 */ @Service public class ManUserService { @Autowired private ManUserRoleBiz manUserRoleBiz; @Autowired private ManUserGroupBiz manUserGroupBiz; @Autowired private ManRoleResourceBiz manRoleResourceBiz; @Autowired private UserPassportBiz userPassportBiz; @Autowired private ManGroupRoleBiz manGroupRoleBiz; @Autowired private ManResourceBiz manResourceBiz; /** * * * @param uid * @return ?????null. */ public UserAuthInfo getUserAuthInfo(long uid) { UserAuthInfo userAuthInfo = new UserAuthInfo(String.valueOf(uid)); Set<Integer> groupIds = manUserGroupBiz.getGroupIdsByUid(uid); Set<Integer> roleIds = manGroupRoleBiz.getRoleIdsByGroupIds(groupIds); roleIds.addAll(manUserRoleBiz.getRoleIdsByUid(uid)); if (!roleIds.isEmpty()) { for (Integer roleId : roleIds) { userAuthInfo.addRole(roleId.toString()); } Set<Integer> permissionIds = manRoleResourceBiz.getResourceIdsByRoleIds(roleIds); Set<String> permissions = manResourceBiz.getPermissionByIds(permissionIds); userAuthInfo.setPermissions(permissions); } return userAuthInfo; } public UserPassport getUserPassportFromOriginPwd(long uid, String originPwd) { return userPassportBiz.getUserPassportFromOriginPwd(uid, originPwd); } public UserPassport getUserPassportFromEncryptedPwd(long uid, String encryptedPwd) { return userPassportBiz.getUserPassport(uid, encryptedPwd); } }