|
@@ -172,6 +172,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
|
loginRes.setTabBar(tabBar);
|
|
loginRes.setTabBar(tabBar);
|
|
|
}
|
|
}
|
|
|
|
|
+ applyAppModulePermissions(loginRes, loginBase, null);
|
|
|
loginRes.setRefreshToken(refreshToken);
|
|
loginRes.setRefreshToken(refreshToken);
|
|
|
return HttpResult.ok(loginRes);
|
|
return HttpResult.ok(loginRes);
|
|
|
}
|
|
}
|
|
@@ -265,6 +266,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
|
loginRes.setTabBar(tabBar);
|
|
loginRes.setTabBar(tabBar);
|
|
|
}
|
|
}
|
|
|
|
|
+ applyAppModulePermissions(loginRes, loginBase, user.getRoleName());
|
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
|
loginRes.setValid(true);
|
|
loginRes.setValid(true);
|
|
|
} else {
|
|
} else {
|
|
@@ -354,6 +356,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
|
loginRes.setTabBar(tabBar);
|
|
loginRes.setTabBar(tabBar);
|
|
|
}
|
|
}
|
|
|
|
|
+ applyAppModulePermissions(loginRes, loginBase, user.getRoleName());
|
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
|
loginRes.setValid(true);
|
|
loginRes.setValid(true);
|
|
|
} else {
|
|
} else {
|
|
@@ -517,6 +520,9 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginRes.setToken(token);
|
|
loginRes.setToken(token);
|
|
|
loginRes.setDeptId(user.getDeptId());
|
|
loginRes.setDeptId(user.getDeptId());
|
|
|
loginRes.setRoleId(user.getRoleId());
|
|
loginRes.setRoleId(user.getRoleId());
|
|
|
|
|
+ LoginBase loginBase = new LoginBase();
|
|
|
|
|
+ loginBase.setClientType(clientType);
|
|
|
|
|
+ applyAppModulePermissions(loginRes, loginBase, user.getRoleName());
|
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
|
loginRes.setValid(true);
|
|
loginRes.setValid(true);
|
|
|
} else {
|
|
} else {
|
|
@@ -855,6 +861,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
|
loginRes.setTabBar(tabBar);
|
|
loginRes.setTabBar(tabBar);
|
|
|
}
|
|
}
|
|
|
|
|
+ applyAppModulePermissions(loginRes, loginBase, null);
|
|
|
return loginRes;
|
|
return loginRes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -891,6 +898,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(tabBar)) {
|
|
|
loginRes.setTabBar(tabBar);
|
|
loginRes.setTabBar(tabBar);
|
|
|
}
|
|
}
|
|
|
|
|
+ applyAppModulePermissions(loginRes, loginBase, user.getRoleName());
|
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
if (user.getSystemType().equals(SystemTypeEnum.MANAGE.getCode())) {
|
|
|
loginRes.setValid(true);
|
|
loginRes.setValid(true);
|
|
|
} else {
|
|
} else {
|
|
@@ -907,10 +915,54 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
|| Objects.equals(clientType, ClientTypeEnum.mobile.getValue());
|
|
|| Objects.equals(clientType, ClientTypeEnum.mobile.getValue());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void applyAppModulePermissions(LoginResVo1 loginRes, LoginBase loginBase, String roleName) {
|
|
|
|
|
+ loginRes.setShowOrderStatisticsModule(Boolean.FALSE);
|
|
|
|
|
+ loginRes.setShowSalesStatisticsModule(Boolean.FALSE);
|
|
|
|
|
+ loginRes.setShowWalletModule(Boolean.FALSE);
|
|
|
|
|
+ loginRes.setWalletModuleItems(Collections.emptyList());
|
|
|
|
|
+ if (!isAppLogin(loginBase) || StringUtils.isBlank(roleName)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean isSeller = containsAnyRole(roleName, "销售");
|
|
|
|
|
+ boolean isFinance = containsAnyRole(roleName, "财务");
|
|
|
|
|
+ boolean isPurchase = containsAnyRole(roleName, "采购", "买家");
|
|
|
|
|
+ if (isSeller) {
|
|
|
|
|
+ loginRes.setShowOrderStatisticsModule(Boolean.TRUE);
|
|
|
|
|
+ loginRes.setShowSalesStatisticsModule(Boolean.TRUE);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isFinance) {
|
|
|
|
|
+ loginRes.setShowOrderStatisticsModule(Boolean.TRUE);
|
|
|
|
|
+ loginRes.setShowWalletModule(Boolean.TRUE);
|
|
|
|
|
+ loginRes.setWalletModuleItems(Arrays.asList("PENDING_PERFORMANCE_BALANCE", "PENDING_FREIGHT"));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isPurchase) {
|
|
|
|
|
+ loginRes.setShowOrderStatisticsModule(Boolean.TRUE);
|
|
|
|
|
+ loginRes.setShowWalletModule(Boolean.TRUE);
|
|
|
|
|
+ loginRes.setWalletModuleItems(Arrays.asList("PREPAY_BALANCE", "PENDING_FREIGHT"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private boolean containsAnyRole(String roleName, String... roleKeywords) {
|
|
|
|
|
+ if (StringUtils.isBlank(roleName) || roleKeywords == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (String roleKeyword : roleKeywords) {
|
|
|
|
|
+ if (StringUtils.isNotBlank(roleKeyword) && roleName.contains(roleKeyword)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private List<LoginResVo1.TabBarItem> buildAppTabBar(LoginBase loginBase, String roleName,int flag) {
|
|
private List<LoginResVo1.TabBarItem> buildAppTabBar(LoginBase loginBase, String roleName,int flag) {
|
|
|
if (!isAppLogin(loginBase)) {
|
|
if (!isAppLogin(loginBase)) {
|
|
|
return List.of();
|
|
return List.of();
|
|
|
}
|
|
}
|
|
|
|
|
+ if (containsAnyRole(roleName, "采购")) {
|
|
|
|
|
+ return buildBuyerTabBar();
|
|
|
|
|
+ }
|
|
|
boolean isDoorKeeper = StringUtils.isNotBlank(roleName) && roleName.contains("门卫");
|
|
boolean isDoorKeeper = StringUtils.isNotBlank(roleName) && roleName.contains("门卫");
|
|
|
boolean isForkliftDriver = StringUtils.isNotBlank(roleName) && roleName.contains("铲车司机");
|
|
boolean isForkliftDriver = StringUtils.isNotBlank(roleName) && roleName.contains("铲车司机");
|
|
|
boolean isBuyer = StringUtils.isNotBlank(roleName) && roleName.contains("买家");
|
|
boolean isBuyer = StringUtils.isNotBlank(roleName) && roleName.contains("买家");
|