提交
This commit is contained in:
@@ -185,4 +185,37 @@ public class SecurityUtils
|
||||
.anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否需要隐藏金额字段
|
||||
* 工程角色(engineering)和采购角色(purchase)需要隐藏金额字段
|
||||
*
|
||||
* @return 是否需要隐藏金额字段
|
||||
*/
|
||||
public static boolean isHideAmount()
|
||||
{
|
||||
List<SysRole> roleList = getLoginUser().getUser().getRoles();
|
||||
Collection<String> roles = roleList.stream().map(SysRole::getRoleKey).collect(Collectors.toSet());
|
||||
return roles.contains("engineering") || roles.contains("purchase");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否为工程角色
|
||||
*
|
||||
* @return 是否为工程角色
|
||||
*/
|
||||
public static boolean isEngineeringRole()
|
||||
{
|
||||
return hasRole("engineering");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否为采购角色
|
||||
*
|
||||
* @return 是否为采购角色
|
||||
*/
|
||||
public static boolean isPurchaseRole()
|
||||
{
|
||||
return hasRole("purchase");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user